Configuring ElmerFEM-GUI fails because VTK can't find Python

Just as the title says, I’m trying to build ElmerFEM-GUI, but I’m unable to make it through the configuration process because it seems that a VTK cmake script is failing to find the installed python package. The issue is that I have Python 3.10.6 installed. This was verified with python3 --version.

I have already have unresolved issues with detecting libGLEW.so (Issues in configuring software with VTK Dependency - Fails in VTK cmake files). I only made it to this point because I found a hacky way to modify the cmake script.

The output of cmake for the issue relating to Python is below.

 Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so  found components:  OpenGL GLX
 CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
   Could NOT find Python3 (missing: Python3_EXECUTABLE Python3_INCLUDE_DIRS
   Interpreter Development.Module) (Required is at least version "3.10")
 Call Stack (most recent call first):
   /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
   /usr/share/cmake-3.22/Modules/FindPython/Support.cmake:3180 (find_package_handle_standard_args)
   /usr/share/cmake-3.22/Modules/FindPython3.cmake:490 (include)
   /usr/lib/x86_64-linux-gnu/cmake/vtk-9.1/VTK-vtk-module-find-packages.cmake:350 (find_package)
   /usr/lib/x86_64-linux-gnu/cmake/vtk-9.1/vtk-config.cmake:150 (include)
   ElmerGUI/CMakeLists.txt:106 (FIND_PACKAGE)

 Configuring incomplete, errors occurred!
 See also "/zfs_pool/Engineering/elmerfem/build/CMakeFiles/CMakeOutput.log".
 See also "/zfs_pool/Engineering/elmerfem/build/CMakeFiles/CMakeError.log".

the (missing: Python3_INCLUDE_DIRS message is your clue that you need the development package for python3 - so not just the interpreter, but sudo apt install python3-dev as well. You can look at the vtk build doc for more information about dependencies.

@Aron_Helser

So, I ran into many issues since your message. I ultimately reinstalled Ubuntu 20.04 as opposed the 22.04 I was previously using, but I’m back at the same point just with out the (missing: Python3_INCLUDE_DIRS) message. Unlike previously, I do have python3.9-dev installed.

The error output is listed below. Please note that line 3226 should be 3222, but I have added message lines to “*/FindPython/Support.cmake” in an attempt to perform a bit of debugging. The code I added is further down.

PREFIX: Python3

 required_vars: Python3_EXECUTABLE;Python3_INCLUDE_DIRS

 version_var: 3.9

 reason_failure: REASON_FAILURE_MESSAGE;

 CMake Error at cmake/Modules/FindPackageHandleStandardArgs.cmake:166 (message):
   Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS():
   "REASON_FAILURE_MESSAGE"
 Call Stack (most recent call first):
   /usr/local/lib/cmake/vtk-9.2/patches/3.23/FindPython/Support.cmake:3226 (find_package_handle_standard_args)
   /usr/local/lib/cmake/vtk-9.2/patches/3.23/FindPython3.cmake:490 (include)
   /usr/local/lib/cmake/vtk-9.2/VTK-vtk-module-find-packages.cmake:303 (find_package)
   /usr/local/lib/cmake/vtk-9.2/vtk-config.cmake:152 (include)
   ElmerGUI/CMakeLists.txt:106 (FIND_PACKAGE)
message("PREFIX: ${_PYTHON_PREFIX}")
message("required_vars: ${_${_PYTHON_PREFIX}_REQUIRED_VARS}")
message("version_var: ${_${_PYTHON_PREFIX}_VERSION}${_python_handle_version_range}")
message("reason_failure: ${_python_reason_failure_args}")

Update: I was able to make it just a touch further. I had to change the maximum allowable cmake version to be 3.17 by modifying line 3210. I have 3.16.3 installed, so it was killing the compile. However, I now have the error messages shown below.

 PREFIX: Python3

 required_vars: Python3_EXECUTABLE;Python3_INCLUDE_DIRS

 version_var:

 reason_failure:

 CMake Error at cmake/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
   Could NOT find Python3 (missing: Development.Module) (found suitable
   version "3.9.5", minimum required is "3.9")
 Call Stack (most recent call first):
   cmake/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
   /usr/local/lib/cmake/vtk-9.2/patches/3.23/FindPython/Support.cmake:3226 (find_package_handle_standard_args)
   /usr/local/lib/cmake/vtk-9.2/patches/3.23/FindPython3.cmake:490 (include)
   /usr/local/lib/cmake/vtk-9.2/VTK-vtk-module-find-packages.cmake:303 (find_package)
   /usr/local/lib/cmake/vtk-9.2/vtk-config.cmake:152 (include)
   ElmerGUI/CMakeLists.txt:106 (FIND_PACKAGE)

@Aron_Helser

I updated cmake to 3.26.4 to see if that would help, but it did not. However, it did change the error call stack. The new call stack is below.

 CMake Error at /usr/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
   Could NOT find Python3 (missing: Development.Module)
 Call Stack (most recent call first):
   /usr/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
   /usr/share/cmake-3.26/Modules/FindPython/Support.cmake:3766 (find_package_handle_standard_args)
   /usr/share/cmake-3.26/Modules/FindPython3.cmake:551 (include)
   /usr/local/lib/cmake/vtk-9.2/VTK-vtk-module-find-packages.cmake:303 (find_package)
   /usr/local/lib/cmake/vtk-9.2/vtk-config.cmake:152 (include)
   ElmerGUI/CMakeLists.txt:106 (FIND_PACKAGE)