Closed clnFind closed 4 years ago
You have Python 3.7 installed in /Users/cln/.pyenv/shims/python3.7
. How did you install it?
In the CMakeLists.txt
file in the root of the repository, on line 146, it says
find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION})
Change this line to
find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} REQUIRED)
and run CMake again. You should now get an error message that might indicate what the problem with your Python installation is.
@crisluengo Yes, I uninstalled Python 3.7, but I got this following error:
CMake Error at dependencies/pybind11/tools/FindPythonLibsNew.cmake:95 (message):
Python config failure:
pyenv: python3.6: command not found
The `python3.6' command exists in these Python versions:
3.6.0
I'm not sure what that error message means. It looks like it identifies Python3.6 as installed, but then cannot run it. I have not had problems in the past using the Python in a virtual environment for building this project.
Why did you uninstall 3.7? Which version of Python do you intend to use? You can add -DPYBIND11_PYTHON_VERSION=3.6
to your CMake command if you want to build explicitly against the 3.6 version of Python, but you need to have that version installed.
Do delete your CMakeCache.txt
file if you are going to change the version of Python you build for, just in case CMake gets confused with old values.
@crisluengo I mainly use Python 3.6, rarely 3.7, following your method, the following errors occurred:
CMake Error at /usr/local/Cellar/cmake/3.11.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find PythonInterp: Found unsuitable version "1.4", but required
is at least "3.6" (found /Users/cln/.pyenv/shims/python3.6)
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.11.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:376 (_FPHSA_FAILURE_MESSAGE)
/usr/local/Cellar/cmake/3.11.1/share/cmake/Modules/FindPythonInterp.cmake:155 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
dependencies/pybind11/tools/FindPythonLibsNew.cmake:60 (find_package)
CMakeLists.txt:147 (find_package)
-- Configuring incomplete, errors occurred!
Strange that it sees the wrong version string there. I do not understand this error. I think pyenv might be confusing the CMake scripts that try to find the Python executable and associated libraries.
One workaround could be to add the following defines to your CMake command:
-DPYTHON_EXECUTABLE=/usr/local/bin/python3.7
-DPYTHON_LIBRARY=/usr/local/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7m.dylib
-DPYTHON_INCLUDE_DIR=/usr/local/Frameworks/Python.framework/Versions/3.7/include/python3.7m/
(I've put in valid directories for my installation, which I have through Homebrew. You'll have to find the relevant directories on your system.)
If you use an Anaconda installation of Python, this CMake script might help us, but let's see if the above solves it, because it'll be more effort to figure out how to use this other script.
@crisluengo Thanks very much, it works. I use pyenv-virtualenv, no anaconda. I run the following command:
cmake -DCMAKE_BUILD_TYPE=Debug
-DPYTHON_EXECUTABLE=/Users/cln/.pyenv/shims/python
-DPYBIND11_PYTHON_VERSION=3.6
-DPYTHON_INCLUDE_DIR=/Users/cln/.pyenv/versions/3.6.0/include/python3.6m
-DPYTHON_LIBRARIES=/Users/cln/.pyenv/versions/3.6.0/lib/libpython3.6m.a
-DCMAKE_CXX_COMPILER=g++-8
-DBIOFORMATS_JAR=$HOME/java/bioformats_package.jar
-DJAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home ..
-- Found PythonInterp: /Users/cln/.pyenv/shims/python (found suitable version "3.6", minimum required is "3.6")
-- Found PythonLibs: /Users/cln/.pyenv/versions/3.6.0/lib/libpython3.6m.a
-- Performing Test HAS_CPP14_FLAG
-- Performing Test HAS_CPP14_FLAG - Success
-- pybind11 v2.2.4
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Failed
-- LTO disabled (not supported by the compiler and/or linker)
-- Could NOT find Matlab (missing: Matlab_INCLUDE_DIRS Matlab_MEX_LIBRARY Matlab_MEX_EXTENSION Matlab_ROOT_DIR Matlab_MX_LIBRARY MAIN_PROGRAM) (found version "NOTFOUND")
DIPlib CONFIGURATION REPORT
Next, type 'make; make check; make install'
@clnFind Thanks so much for reporting back!
Component DIPimage / PyDIP / CMake build scripts. installed from sources
Describe the bug
System information: