Building ParaView 5.8.1 fails because it can not find python

I’m trying to build ParaView 5.8.1 and I’m enabling PARAVIEW_USE_PYTHON I’m trying to pass the paths to my python installation which is python 3.6. I get the following error:
CMake Error at VTK/CMake/vtkModule.cmake:4111 (message):
Could not find the Python3 external dependency.
Call Stack (most recent call first):
VTK/Utilities/Python/CMakeLists.txt:44 (vtk_module_find_package)

Things I need to mention:
1- I have built ParaView 5.6 successfully before by passing the following paths to cmake:
-DPYTHON_EXECUTABLE=python3.6/install/bin/python3.6 -DPYTHON_INCLUDE_DIR=python3.6/install/include/python3.6m -DPYTHON_LIBRARY=python3.6/install/lib/libpython3.6m.a

2- When I go through the cmake variables I do not find the variables above I only find the following:
Python3_LIBRARY_DEBUG
Python3_LIBRARY_RELEASE
I tried passing the library path I mentioned above and it is not recognizing it and after I configure I get Python3_LIBRARY_RELEASE Python3_LIBRARY_RELEASE-NOTFOUND

We changed from FindPythonLibs and FindPythonInterp between 5.6 and 5.8, so the variables are a bit different. There should probably be a log about why it couldn’t be found before the actual error.

I also suspect you want full paths, not relative paths, for the setting you’re passing.

Hi Ben,

I tried passing the full path to Python3_LIBRARY_RELEASE and I still get Python3_LIBRARY_RELEASE Python3_LIBRARY_RELEASE-NOTFOUND.
What is the correct way to pass the paths to the python installation?

Given what you’ve shown, what happens if you pass the full path to python3.6/install as CMAKE_PREFIX_PATH?

I get the same error after configuration
CMake Error at VTK/CMake/vtkModule.cmake:4111 (message):
Could not find the Python3 external dependency.
Call Stack (most recent call first):
VTK/Utilities/Python/CMakeLists.txt:44 (vtk_module_find_package)

I made sure to delete my build directory before trying again

There should be a message before that error about why Python3 is considered to be not found. Could you post the full output from CMake?

This is the message I get:

-- Could not use git to determine source version, using version 5.8.0
-- Could NOT find Python3 (missing: Python3_LIBRARIES Python3_INCLUDE_DIRS Development) (Required is at least version "3.2")
CMake Error at VTK/CMake/vtkModule.cmake:4111 (message):
Could not find the Python3 external dependency.
Call Stack (most recent call first):
VTK/Utilities/Python/CMakeLists.txt:44 (vtk_module_find_package)

-- Configuring incomplete, errors occurred!

CMakeError.log (92.3 KB)

It seems that you have the Python interpreter, but not the headers and the libpython library available.

Hi Ben,

I have the libpython under the path /usr/rb/python3.6/install/lib/libpython3.6m.a the headers under /usr/rb/python3.6/install/include/python3.6m/ and the execution under /usr/rb/python3.6/install/bin/. I just seem to not pass them correctly to CMake.

I tried
1- passing the paths for Python3_LIBRARIES, and Python3_INCLUDE_DIRS
2- passing the path to VTK_PYTHON_SITE_PACKAGES_SUFFIX

I’m still getting an error. Also when I go searching for python variables in the CMakeCache, I only find the following: Python3_LIBRARY_DEBUG:FILEPATH and Python3_LIBRARY_RELEASE:FILEPATH. There are no paths for include or execution.

One more thing, I tried building ParaView 5.9 and it built fine after assigning VTK_PYTHON_OPTIONAL_LINK=OFF which is a variable that I cannot find in 5.8. Unfortunately the data that I’m working with did not work on 5.9 and I need 5.8.

I had this same error. It was resolved by downgrading python to 3.8 from 3.9.

Hello,
I have a similar problem while trying to install Paraview 5.7 with Python 3.6. Here is the error message I get:

CMake Error at VTK/CMake/patches/99/FindPython/Support.cmake:1760 (file):
file STRINGS file “/usr/local/include/python3.6/patchlevel.h” cannot be
read.
Call Stack (most recent call first):
VTK/CMake/patches/99/FindPython3.cmake:256 (include)
VTK/CMake/vtkModule.cmake:3646 (find_package)
VTK/Utilities/Python/CMakeLists.txt:44 (vtk_module_find_package)

CMake Error at VTK/CMake/patches/99/FindPython/Support.cmake:1765 (list):
list GET given empty list
Call Stack (most recent call first):
VTK/CMake/patches/99/FindPython3.cmake:256 (include)
VTK/CMake/vtkModule.cmake:3646 (find_package)
VTK/Utilities/Python/CMakeLists.txt:44 (vtk_module_find_package)

CMake Error at VTK/CMake/patches/99/FindPython/Support.cmake:1766 (list):
list GET given empty list
Call Stack (most recent call first):
VTK/CMake/patches/99/FindPython3.cmake:256 (include)
VTK/CMake/vtkModule.cmake:3646 (find_package)
VTK/Utilities/Python/CMakeLists.txt:44 (vtk_module_find_package)

CMake Error at VTK/CMake/patches/99/FindPython/Support.cmake:1767 (list):
list GET given empty list
Call Stack (most recent call first):
VTK/CMake/patches/99/FindPython3.cmake:256 (include)
VTK/CMake/vtkModule.cmake:3646 (find_package)
VTK/Utilities/Python/CMakeLists.txt:44 (vtk_module_find_package)

Could NOT find Python3 (missing: Development) (found suitable version “3.6.11”, minimum required is “3.2”)
CMake Error at VTK/CMake/vtkModule.cmake:3652 (message):
Could not find the Python3 external dependency.
Call Stack (most recent call first):
VTK/Utilities/Python/CMakeLists.txt:44 (vtk_module_find_package)

Configuring incomplete, errors occurred!

In the ccmake, I set:

Python3_EXECUTABLE /usr/local/bin/python3.6
Python3_INCLUDE_DIR /usr/local/include/python3.6
Python3_LIBRARY_DEBUG Python3_LIBRARY_DEBUG-NOTFOUND
Python3_LIBRARY_RELEASE /usr/local/lib/libpython3.6m.so

What did I miss?

Thank you for your help,

I think there were some problems with FindPython around the time 5.7 was release. I would recommend removing the files from cmake/patches/99 and using a newer CMake instead.

Thank you Ben.

I use CMake 3.18.3. Should I upgrade to 3.19.6 ?

The key is to remove the FindPython bits from VTK/CMake/patches/99. 3.18 should be sufficient.

Thanks a lot for your answer, Ben. However, the problem is still not solved.

I deleted the content of VTK/CMake/patches/99.
I checked all my paths and symbolic links.
Some errors seem to be solved.

Last error is now:

Could NOT find Python3 (missing: Development Development.Module Development.Embed) (found suitable version “3.7”, minimum
required is “3.2”)
CMake Error at VTK/CMake/vtkModule.cmake:3652 (message):
Could not find the Python3 external dependency.
Call Stack (most recent call first):
VTK/Utilities/Python/CMakeLists.txt:44 (vtk_module_find_package)

It seems like Development is missing or not found. I checked and python3-dev is installed, however, it seems to be version 3.8.6-0ubuntu1 and I’m trying to use python version 3.6.11.

Do you have an idea on how to solve this?

Thank you again

You’ll need to point the include directory and library paths to the relevant paths manually. It seems that it just isn’t searching properly. You can see what is needed by getting this project to find your Python rather than working with the full VTK configure cycle:

cmake_minimum_required(VERSION 3.12)
project(findmypython NONE)
find_package(Python3 COMPONENTS Development Development.Module Development.Embed)
if (NOT Python3_FOUND)
  message(FATAL_ERROR "not found")
endif ()
if (NOT Python3_VERSION STREQUAL "3.6.11")
  message(FATAL_ERROR "wrong python found")
endif ()

Hi Ben,

Your project gives me:

Found Python3: /usr/include/python3.8 (found version "3.8.6") found
components: Development Development.Module Development.Embed
CMake Error at CMakeLists.txt:8 (message):
    wrong python found

Where are the path to python defined?

I already change the link /usr/bin/python3 to point to my /usr/local/bin/python3.6 instead of /usr/bin/python3.8, without success.

Is there another place?

The docs for FindPython3 specify how to control what it finds. You’ll need to figure out what needs to be specified to make that work. Once it does, VTK does the same thing internally, so you’ll need to pass that to ParaView’s configure as well.

Of note is Python3_FIND_STRATEGY.

Thanks to your precious help, Ben, I finally succeeded in installing Paraview. Many thanks again.

In short, I solved the problem by :

  1. commenting lines 506, 508 and 510 in paraview/VTK/CMake/patches/99/FindPython/Support.cmake to force the use of set (_${_PYTHON_PREFIX}_FIND_STRATEGY “LOCATION”)
  2. adapting the path at the configure step of cmake to point to my local version of Python3.6 (in /usr/local

During the compilation itself, at 12%, I got following error:

 /usr/bin/ld : CMakeFiles/exodusII.dir/src/ex_open_par.c.o:/home/user/paraview/VTK/ThirdParty/exodusII
 /vtkexodusII/src/ex_open_par.c:475 : définitions multiples de « exodus_unused_symbol_dummy_1 »; 
 MakeFiles/exodusII.dir/src/ex_create_par.c.o:/home/user/paraview/VTK/ThirdParty/exodusII/vtkexodusII
 src/ex_create_par.c:218 : défini pour la première fois ici
 collect2: error: ld returned 1 exit status
 make[2]: *** [VTK/ThirdParty/exodusII/vtkexodusII/CMakeFiles/exodusII.dir/build.make:4171 : 
 lib/libvtkexodusII-pv5.7.so.5.7] Erreur 1
 make[1]: *** [CMakeFiles/Makefile2:24445 : VTK/ThirdParty/exodusII/vtkexodusII/CMakeFiles
 exodusII.dir/all] Erreur 2
 make: *** [Makefile:160 : all] Erreur 2

I solved it by commenting line 475 in paraview/VTK/ThirdParty/exodusII/vtkexodusII/src/ex_open_par.c

try if pip install vtk in the terminal you need the python wrappings from the vtk python module to interact with the c++ code