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

**URL:** https://discourse.vtk.org/t/configuring-elmerfem-gui-fails-because-vtk-cant-find-python/11824
**Category:** Support
**Created:** [June 26, 2023, 6:49pm UTC](https://discourse.vtk.org/t/configuring-elmerfem-gui-fails-because-vtk-cant-find-python/11824 "2023-06-26T18:49:05Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![EnderWiggin14](https://discourse.vtk.org/user_avatar/discourse.vtk.org/enderwiggin14/32/7345_2.png) [@EnderWiggin14](https://discourse.vtk.org/u/EnderWiggin14)
#### Post date: [June 26, 2023, 6:49pm UTC](https://discourse.vtk.org/t/configuring-elmerfem-gui-fails-because-vtk-cant-find-python/11824/1 "2023-06-26T18:49:05Z")

</div>

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](https://discourse.vtk.org/t/issues-in-configuring-software-with-vtk-dependency-fails-in-vtk-cmake-files/11805)). 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.

```auto
 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".

```

---

<div class="post-metadata">

### Author: ![Aron\_Helser](https://discourse.vtk.org/user_avatar/discourse.vtk.org/aron_helser/32/14_2.png) [@Aron\_Helser](https://discourse.vtk.org/u/Aron_Helser)
#### Post date: [June 27, 2023, 4:09pm UTC](https://discourse.vtk.org/t/configuring-elmerfem-gui-fails-because-vtk-cant-find-python/11824/2 "2023-06-27T16:09:01Z")

</div>

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](https://gitlab.kitware.com/vtk/vtk/-/blob/master/Documentation/dev/build.md) for more information about dependencies.

---

<div class="post-metadata">

### Author: ![EnderWiggin14](https://discourse.vtk.org/user_avatar/discourse.vtk.org/enderwiggin14/32/7345_2.png) [@EnderWiggin14](https://discourse.vtk.org/u/EnderWiggin14)
#### Post date: [July 5, 2023, 7:37pm UTC](https://discourse.vtk.org/t/configuring-elmerfem-gui-fails-because-vtk-cant-find-python/11824/3 "2023-07-05T19:37:00Z")

</div>

@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.

```auto
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)

```

```auto
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.

```auto
 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)

```

---

<div class="post-metadata">

### Author: ![EnderWiggin14](https://discourse.vtk.org/user_avatar/discourse.vtk.org/enderwiggin14/32/7345_2.png) [@EnderWiggin14](https://discourse.vtk.org/u/EnderWiggin14)
#### Post date: [July 6, 2023, 9:22pm UTC](https://discourse.vtk.org/t/configuring-elmerfem-gui-fails-because-vtk-cant-find-python/11824/4 "2023-07-06T21:22:26Z")

</div>

@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.

```auto
 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)

```
