InsightSoftwareConsortium / ITK

Insight Toolkit (ITK) -- Official Repository. ITK builds on a proven, spatially-oriented architecture for processing, segmentation, and registration of scientific images in two, three, or more dimensions.
https://itk.org
Apache License 2.0
1.4k stars 664 forks source link

Installation of Python wrappings fails #3306

Closed SimonRit closed 2 years ago

SimonRit commented 2 years ago

Description

Installation of a local compilation of Python wrappings fails with the following message

CMake Error at Wrapping/Generators/Python/PyBase/cmake_install.cmake:49 (file):
  file INSTALL cannot find
  "/home/srit/src/itk/lin64-PythonWrapping/Wrapping/Generators/Python/itk/pyBase.py":
  No such file or directory.
Call Stack (most recent call first):
  Wrapping/cmake_install.cmake:47 (include)
  cmake_install.cmake:812 (include)

Steps to Reproduce

I am using the following bash command:

cmake $SCRIPT_PATH/itk \
    -DITKPythonPackage_ITK_BINARY_REUSE:BOOL=OFF \
    -DITKPythonPackage_WHEEL_NAME:STRING="itk" \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
    -DBUILD_EXAMPLES=OFF \
    -DBUILD_SHARED_LIBS=OFF \
    -DBUILD_TESTING=OFF \
    -DITK_WRAP_PYTHON=ON \
    -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH \
    -DModule_RTK:BOOL=ON \
    -DModule_RTK_GIT_TAG="" \
    -DRTK_USE_CUDA:BOOL=ON \
    -DRTK_BUILD_APPLICATIONS:BOOL=OFF \
    -DPY_SITE_PACKAGES_PATH:STRING=${BINDINGS_PATH} \
    -DITK_WRAP_unsigned_short:BOOL=ON \
    -DITK_WRAP_double:BOOL=ON \
    -DITK_WRAP_complex_double:BOOL=ON \
    -DITK_WRAP_IMAGE_DIMS:STRING="2;3;4"
make -k -j${NTHREADS} install

Expected behavior

Installation without error.

Actual behavior

Installation with error reported above

Reproducibility

100%

Versions

ITK and RTK master branches.

Environment

Linux Suse, gcc 7.5.0

Additional Information

thewtex commented 2 years ago

@hjmjohnson @jcfr CC

This is currently preventing generation of wheels.

thewtex commented 2 years ago

https://github.com/InsightSoftwareConsortium/ITK/pull/3303 seems to be related. The file in my build tree is pyBasePython.py instead of pyBase.py.

hjmjohnson commented 2 years ago

I'm trying to figure out what the correct answer is. I've been debugging this all day today. It is quite frustrating that the rebuilds take 20 minutes each, and the wrapping is still very very fragile.

hjmjohnson commented 2 years ago

@SimonRit I'm investigating this now. can you help me identify what the following two lines are for

    -DITKPythonPackage_ITK_BINARY_REUSE:BOOL=OFF \
    -DITKPythonPackage_WHEEL_NAME:STRING="itk" \

I cannot find these strings in any cmake files in the ITK tree.

SimonRit commented 2 years ago

Thanks for the hard work. I have tried to mimick with this script what's done in https://github.com/InsightSoftwareConsortium/ITKPythonPackage/blob/master/scripts/internal/manylinux-build-wheels.sh#L78-L79. According to git blame, @jcfr might know?

thewtex commented 2 years ago
-DITKPythonPackage_ITK_BINARY_REUSE:BOOL=OFF \

-DITKPythonPackage_WHEEL_NAME:STRING="itk" \

These are part of the packaging of the Python wheels in the ITKPythonPackage repository.

However, the install rule issues can be uncovered just by installing into a temporary test prefix. For example,

DESTDIR=/tmp/itk-test-prefix ninja install

rebuilds take 20 minutes each,

Excited for your fix in #3303 to get us back to incremental builds.

I have high hopes for C++ module header units. More work to be done, hopefully we can build the wheels with GitHub Actions on this repository. Good discussions with NumFOCUS today -- good opportunities for CI support there, too.

SimonRit commented 2 years ago

Fixed by #3303, thanks @hjmjohnson!