Build preCICE with python support

Hi

I’m trying to build preCICE with python support to use python callback action. I followed the tutorial in the official website. I type following orders in build:

cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/users/xsb19199/fsi/precice-2.2.0/ -DPRECICE_PETScMapping=OFF -DPRECICE_PythonActions=ON  ..

and I got this error:

  Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)
Call Stack (most recent call first):
  /opt/software/cmake/gcc/3.19.1/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:577 (_FPHSA_FAILURE_MESSAGE)
  /opt/software/cmake/gcc/3.19.1/share/cmake-3.19/Modules/FindPythonLibs.cmake:310 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:236 (find_package)


-- Configuring incomplete, errors occurred!

Does anyone know how to fix this? Thanks!

  • preCICE version:2.2.0
  • Redhat
  • Installation method: building with CMake

cmake is telling you that you asked it to compile precice with python support, but it doesn’t know where to find the necessary header files that it needs to give the compiler in order to build precice with that python support. So, it’s asking you where a directory of those header files is, and it wants you to assign that directory location to a specific cmake variable. From this error message I think that cmake variable is called “PYTHON_INCLUDE_DIRS”.

So, you need to go find the directory full of header files within your python install location and modify the command you send cmake.

For example, your header files may be located in /opt/Software/python/3.7/include. If so, you’d want to add -DPYTHON_INCLUDE_DIRS=/opt/Software/python/3.7/include to your command.

There may be subsequent things that cmake looks for once you give it this include directory location too. Just handle them in the same way.

2 Likes