ElmerGUI fails to compile because VTK can't find Python3 (missing Development.Module)

Discussion about building and installing Elmer
Post Reply
ender_wiggin
Posts: 18
Joined: 21 Jun 2023, 22:56
Antispam: Yes

ElmerGUI fails to compile because VTK can't find Python3 (missing Development.Module)

Post by ender_wiggin »

I'm trying to build ElmerFEM with VTK as a support package for the the GUI. However, I'm unable to make it past the configuration step because `Development.Module` cannot be found by the VTK cmake files.

I'm using CMAKE-3.26.4 and VTK-9.2 on Ubuntu 20.04.
I compiled VTK-9.2 myself.

The error call stack that is produced is as follows

Code: Select all

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)


I have `python3.9-dev` and `python3.9` installed. For reference I can demonstrate this through `dpkg -l python3.*` which produces

Code: Select all

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                      Version                 Architecture Description
+++-=========================-=======================-============-============================================================================
un  python3.1                 <none>                  <none>       (no description available)
un  python3.6-2to3            <none>                  <none>       (no description available)
un  python3.7-2to3            <none>                  <none>       (no description available)
ii  python3.8                 3.8.10-0ubuntu1~20.04.8 amd64        Interactive high-level object-oriented language (version 3.8)
un  python3.8-apt             <none>                  <none>       (no description available)
un  python3.8-cairo           <none>                  <none>       (no description available)
un  python3.8-cups            <none>                  <none>       (no description available)
un  python3.8-dbus            <none>                  <none>       (no description available)
ii  python3.8-dev             3.8.10-0ubuntu1~20.04.8 amd64        Header files and a static library for Python (v3.8)
un  python3.8-distutils       <none>                  <none>       (no description available)
un  python3.8-doc             <none>                  <none>       (no description available)
un  python3.8-gdbm            <none>                  <none>       (no description available)
un  python3.8-lib2to3         <none>                  <none>       (no description available)
ii  python3.8-minimal         3.8.10-0ubuntu1~20.04.8 amd64        Minimal subset of the Python language (version 3.8)
un  python3.8-protobuf        <none>                  <none>       (no description available)
un  python3.8-renderpm        <none>                  <none>       (no description available)
un  python3.8-reportlab-accel <none>                  <none>       (no description available)
un  python3.8-talloc          <none>                  <none>       (no description available)
ii  python3.8-venv            3.8.10-0ubuntu1~20.04.8 amd64        Interactive high-level object-oriented language (pyvenv binary, version 3.8)
ii  python3.9                 3.9.5-3ubuntu0~20.04.1  amd64        Interactive high-level object-oriented language (version 3.9)
ii  python3.9-dev             3.9.5-3ubuntu0~20.04.1  amd64        Header files and a static library for Python (v3.9)
un  python3.9-distutils       <none>                  <none>       (no description available)
un  python3.9-doc             <none>                  <none>       (no description available)
un  python3.9-gdbm            <none>                  <none>       (no description available)
un  python3.9-lib2to3         <none>                  <none>       (no description available)
ii  python3.9-minimal         3.9.5-3ubuntu0~20.04.1  amd64        Minimal subset of the Python language (version 3.9)
ii  python3.9-venv            3.9.5-3ubuntu0~20.04.1  amd64        Interactive high-level object-oriented language (pyvenv binary, version 3.9)
When I have searched for help about the vast majority of it is how to actually write cmake scripts with `find_package(Python3 COMPONENTS Interpreter Development` which I'm fairly certain is already done by the VTK developers.

I have already found references elsewhere to set

Code: Select all

cmake .. -DPython3_EXECUTABLE=<absolute path> -DPython3_INCLUDE_DIRS=<absolute path> 
with one also referencing some additional ones

Code: Select all

-DPython3_LIBRARY=<absolute path>` and `-DPython3_LIBRARY_DIRS=<absolute path>
.

However, by using

Code: Select all

cmake .. -DPython3_EXECUTABLE=/usr/bin/python3.9 \
-DPython3_INCLUDE_DIRS=/usr/include/python3.9 \
-DPython3_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.9.so.1 \
-DPython3_LIBRARY_DIRS=/usr/lib/x86_64-linux-gnu/

However, using this didn't change the error produced at the beginning of this post.

I have very little cmake experience, and I don't even know what file or directory is trying to be found when searching for `Development.Module`. How do I remedy this problem?
Rich_B
Posts: 423
Joined: 24 Aug 2009, 20:18

Re: ElmerGUI fails to compile because VTK can't find Python3 (missing Development.Module)

Post by Rich_B »

Hello,

As a check, I opened the Elmer Virtual Machine, with Ubuntu 20, and compiled ElmerGUI with VTK. The compilation was successful and ElmerGUI was able to open the VTK post window.

Maybe take look at using the Elmer VM to compile your code? It might help you find what went wrong with installing some of the required packages, such as Python 3.

Rich.
Truth
Posts: 1
Joined: 24 Jul 2023, 19:12
Antispam: Yes

Re: ElmerGUI fails to compile because VTK can't find Python3 (missing Development.Module)

Post by Truth »

I also have this problem with vtk occt which I have compiled myself and are self consistent with python3. I have set the parameters listed in cmake but the issue remains. Any help would be appreciated. As a note the VM you mention might have vtk compiled without python support. I believe the python headers and what exactly is being looked for are the issue not vtk or occt themselves.

Kind Regards
Post Reply