Cmake not finding the Python libraries

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Cmake not finding the Python libraries

Dimitrova, Maria

Hello,


I am trying to compile a program based on a setup script calling Cmake but I end up with a strange situation where it complains that it cannot find PYTHON_LIBRARIES and PYTHON_INCLUDE_DIRS. I double checked that indeed "which python" returns the one from Anaconda, and that all the environmental variables for it are exported:


export PATH=/MYPATH/anaconda2/bin:${PATH}
export PYTHON_LIBRARY=/MYPATH/anaconda2/lib/libpython2.7.so
export PYTHON_INCLUDE_DIR=/MYPATH/anaconda2/include/python2.7
export PYTHON_LIBRARIES="/MYPATH/anaconda2/lib/libpython2.7.so"
export PYTHON_INCLUDE_DIRS="/MYPATH/anaconda2/include/python2.7"
export PYTHON_EXECUTABLE="/MYPATH/anaconda2/bin/python"


(MYPATH stands for my home directory in this email)


"echo $PYTHON_LIBRARIES" and "echo $PYTHON_INCLUDE_DIRS" are giving the correct paths, as well. 


Cmake is evoked through a ./setup script which can also accept the following arguments:
  --cmake-executable=<CMAKE_EXECUTABLE>  Set the CMake executable [default: cmake].
  --cmake-options=<STRING>               Define options to CMake [default: ''].

and I have tried passing the variables there:

./setup --fc=ifort --extra-fc-flags='-xAVX -axCORE-AVX2,CORE-AVX-I' --cc=icc --extra-cc-flags='-xAVX -axCORE-AVX2,CORE-AVX-I' --cxx=icc --extra-cxx-flags='-xAVX -axCORE-AVX2,CORE-AVX-I' --cmake-options='-DPYTHON_LIBRARIES=/MYPATH/anaconda2/lib/libpython2.7.so -DPYTHON_INCLUDE_DIRS=/MYPATH/anaconda2/include/python2.7'

Yet it crashes with the following output:

CMake Error at /MYPATH/cmake-3.9.4-Linux-x86_64/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)
  (Required is at least version "2.7")
Call Stack (most recent call first):
  /MYPATHcmake-3.9.4-Linux-x86_64/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:377 (_FPHSA_FAILURE_MESSAGE)
  /MYPATH/cmake-3.9.4-Linux-x86_64/share/cmake-3.9/Modules/FindPythonLibs.cmake:262 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:23 (find_package)



Could the problem be caused by a bug in the setup script or something that I have misunderstood about Cmake?


Best regards,

Maria


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake