Conversation
SimonRit
left a comment
There was a problem hiding this comment.
Nice, just two small questions below
| # | ||
| # All paths below can be overridden via environment variables. | ||
|
|
||
| set -euo pipefail |
There was a problem hiding this comment.
-eu look good. Why set -o pipefail? There is no pipe here as far as I can tell.
I would also consider adding -x
| --config-settings=cmake.define.ITK_USE_PYTHON_LIMITED_API=OFF | ||
| ) | ||
| echo "==> Installing RTK Python package (editable)" | ||
| rm -rf "$RTK_PIP_BUILD_DIR" |
There was a problem hiding this comment.
Should we keep the build directory to avoid recompiling from scratch for C++ changes?
6ed7d44 to
87bf024
Compare
|
I made some tests, the script does not do a full rebuild each time a cxx files is changed, so ready to be merged I think |
SimonRit
left a comment
There was a problem hiding this comment.
I'd change the script to compile ITK with CudaCommon and RTK ON instead of compiling RTK separately. What do you think?
| # Prerequisites: | ||
| # - An ITK build tree with Python wrapping enabled (set ITK_DIR) | ||
| # - Optionally CUDA (set RTK_USE_CUDA=ON). | ||
| # When CUDA is enabled, CudaCommon must be findable by ITK. |
There was a problem hiding this comment.
I'd remove this line, CudaCommon is in ITK as a remote module so it's always findable. CUDA might not be findable but that's beyond the scope of this script.
| # Verify that ITK Python wrapping is installed in site-packages. RTK wrapping | ||
| # builds on top of the ITK wrapping infrastructure, so ITK's wrapping shared | ||
| # libraries must already be present. | ||
| ITK_PYTHON_DIR=$(python -c "import itk; import os; print(os.path.dirname(itk.__file__))") |
There was a problem hiding this comment.
If I understand correctly, you must compile ITK first. Why not provide a script that jointly compiles an editable ITK and RTK?
| * Manually download RTK's source repository from [GitHub](https://github.com/RTKConsortium/RTK) with `git` (recommended) or as a [zip package](https://codeload.github.com/RTKConsortium/RTK/zip/main). | ||
| * Configure the project with CMake pointing to RTK's source directory and setting the CMake option `ITK_DIR` to ITK's compilation directory. All CMake options above can be set except `Module_RTK`. | ||
|
|
||
| A convenience script at `utilities/build_rtk_python.sh` builds and installs RTK as a Python package. It must be run from the RTK source directory. It requires ITK and, when using CUDA, CudaCommon, both built with Python wrapping enabled: |
There was a problem hiding this comment.
Replace
A convenience script at `utilities/build_rtk_python.sh`
by
The convenience script [build_rtk_python.sh](utilities/build_rtk_python.sh)
please.
I'm not sure the joint/editable build is the solution. We can't pip install an ITK source tree, it has no pip build system. |
87bf024 to
1291dd9
Compare
Ok, I didn't know one couldn't pip install an ITK source tree. So with this script, one needs to
It's currently not clear that one needs to pip install itk first, I would clarify this if this is the proposed procedure. |
We don't need to pip install itk, we just need to build and install itk with python wrapping (and optionally CudaCommon) and give the build path to the script |
I tried to test this (fresh Python env, built ITK, run the script). Here is the result: So pip install itk is required? |
| * Manually download RTK's source repository from [GitHub](https://github.com/RTKConsortium/RTK) with `git` (recommended) or as a [zip package](https://codeload.github.com/RTKConsortium/RTK/zip/main). | ||
| * Configure the project with CMake pointing to RTK's source directory and setting the CMake option `ITK_DIR` to ITK's compilation directory. All CMake options above can be set except `Module_RTK`. | ||
|
|
||
| The convenience script [build_rtk_python.sh](utilities/build_rtk_python.sh) builds and installs RTK as a Python package. It must be run from the RTK source directory. It requires ITK and, when using CUDA, CudaCommon, both built with Python wrapping enabled: |
There was a problem hiding this comment.
My bad, the link doesn't work. I guess it only works for the .md files copied for readthedocs. Is there a proper way to link to files in the GitHub repository?
So I progressed by adding the ITK bindings to the PYTHONPATH, as I usually do with my local ITK compilation. Then I had to install |
The error appears when compiling the RTK wrapping independently of ITK
with the script utilities/build_rtk_python.sh:
In file included from /home/srit/src/itk/lin64-PythonWrapping/Wrapping/castxml_inputs/itkPyBufferRTK.cxx:16:
/home/srit/src/itk/itk/Modules/Bridge/NumPy/include/itkPyBuffer.h:30:10: fatal error: 'Python.h' file not found
30 | #include <Python.h>
| ^~~~~~~~~~
1 error generated.
gmake[2]: *** [Wrapping/Modules/RTK/CMakeFiles/RTKCastXML.dir/build.make:329: /home/srit/src/itk/lin64-PythonWrapping/Wrapping/castxml_inputs/itkPyBufferRTK.xml] Error 1
gmake[2]: Leaving directory '/home/srit/src/rtk/lin64-toto'
gmake[1]: *** [CMakeFiles/Makefile2:2357: Wrapping/Modules/RTK/CMakeFiles/RTKCastXML.dir/all] Error 2
gmake[1]: Leaving directory '/home/srit/src/rtk/lin64-toto'
gmake: *** [Makefile:146: all] Error 2
|
Ok, it worked with the additional patch I have pushed: |
No description provided.