SIRF-SuperBuild icon indicating copy to clipboard operation
SIRF-SuperBuild copied to clipboard

Need to switch to use CMake's FindPython

Open KrisThielemans opened this issue 5 years ago • 3 comments

See https://github.com/CCPPETMR/SIRF/issues/504

For the SuperBuild, there's an additional problem that not all projects will use FindPython, so somehow we'll have to pass ${Python_EXECUTABLE} to PYTHON_EXECUTABLE. It's going to be messy...

KrisThielemans avatar Jan 26 '20 10:01 KrisThielemans

SIRF PR was https://github.com/SyneRBI/SIRF/pull/868

KrisThielemans avatar Mar 02 '23 10:03 KrisThielemans

Create Python_CMAKE_ARGS and probably define both Python_EXECUTABLE to PYTHON_EXECUTABLE

KrisThielemans avatar Mar 02 '23 10:03 KrisThielemans

This is now pretty urgent, as recent CMake claims this support will be removed.

I've checked for remaining packages using the outdated FindPythonInterp.cmake. There's only 2

  • https://github.com/TomographicImaging/CIL/issues/1835
  • we're using TomoPhantom v2.0.0, which has that problem in its https://github.com/dkazanc/TomoPhantom/blob/v2.0.0/Wrappers/Python/CMakeLists.txt#L14 However, that whole directory no longer exists (v3.0 removed Cython wrappers), so presumably we could upgrade? @gfardell @paskino ?

KrisThielemans avatar Jun 17 '24 23:06 KrisThielemans

In CIL we switched to find_python(Python COMPONENTS Interpreter) and CMake stopped finding the right python. Long story short, we need to pass the path to Python_Executable, see

  • https://github.com/TomographicImaging/CIL/issues/2040

paskino avatar Jan 22 '25 17:01 paskino

yes, of course. Once there are multiple Pythons around, it seems entirely down to luck if CMake finds the one you want. I'd assume it first tries "python" in your (shell) path, which would be fine in an activated conda env, but I don't know if that's really true, so generally recommend -DPython_EXECUTABLE=which python``. This is true for both the outdated and "new" style find_package() way to find python.

It's good to hear that CIL moved on. Maybe we should still cope with older CIL versions in the SB?

What about TomoPhantom? (Personally, I'd suggest to remove this from the default build, if it's still present, that is.)

KrisThielemans avatar Jan 22 '25 19:01 KrisThielemans