Failure to detect python
DJDavies2 opened this issue · 9 comments
ecbuild is failing to detect python for me:
CMake Error at /research/data/d03/frwd/installs/cmake/3.19.4/v1/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message): Could NOT find PythonInterp: Found unsuitable version "2.7.9", but required is at least "3.4" (found /opt/python/gnu/2.7.9/bin/python) Call Stack (most recent call first): /research/data/d03/frwd/installs/cmake/3.19.4/v1/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:580 (_FPHSA_FAILURE_MESSAGE) /research/data/d03/frwd/installs/cmake/3.19.4/v1/share/cmake-3.19/Modules/FindPythonInterp.cmake:169 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) /research/data/d03/frwd/installs/ecbuild/3.6.1-v1/share/ecbuild/cmake/ecbuild_find_python.cmake:94 (find_package) fckit/CMakeLists.txt:25 (ecbuild_find_python)
The system python is python 2 so I have installed python 3 in a custom location. However I don't know how to make fckit pick it up. I have set $PATH to pick up my custom python executable but that doesn't seem to be sufficient.
I believe the way is to set -DPYTHON_EXECUTABLE=<path-to-python3>
in the cmake command line.
Thanks, I will try that.
Hmm, I added -DPYTHON_EXECUTABLE= to the ecbuild line and the stdout says this:
-- �[32m[fckit] (0.9.5) [7ec9cf8]�[m -- Feature TESTS enabled -- Found PythonInterp: /home/d03/frwd/cylc-run/CrayIodaFailure/work/1/build_python__lfric_cray/install/bin/python -- Configuring incomplete, errors occurred!
The stderr is the same as above. So it is finding the executable but in the error still refers to the system python. Do I need to point to a library as well?
Perhaps it is time to ditch this ecbuild_find_python
and use the in the mean time in CMake 3.12 introduced FindPython3, which is a safe assumption as cmake_minimum_required( VERSION 3.12 FATAL_ERROR )
find_package( Python3 REQUIRED COMPONENTS Interpreter )
set( PYTHON_EXECUTABLE ${Python3_EXECUTABLE} ) # For future use within fckit
If you can make that work, then we can go for that with a PR.
yes good point. I support that direction
And likely to force your python executable, then use -DPython3_EXECUTABLE=<path-to-python3>
.
For what it is worth we have other projects that detect python like this:
find_package( Python3 COMPONENTS Interpreter Development )
and this does work for me, i.e. just by setting $PATH to have my custom python build in front. So I would be happy with this fix.
@DJDavies2 did you manage to overcome this particular problem with the above suggestions?
I've managed to overcome this, thanks.