Python3 Not Found

Hi all,

I’am facing a “Could NOT find Python3” problem.
I’am building, with Spack, a ParaView Branded Application named Themys.

On the machine where the installation occurs there is a Python3.11 version installed but just the interpreter. When installing ParaView, Spack installs its own Python, version 3.8, with all components included. The ParaVIew install just runs fine, i.e it find the correct Spack installed full featured Python3.8.

But when the install step comes to Themys, CMake configuration fails with the following message:

CMake Error at /opt/spack/opt/spack/linux-ubuntu23.04-skylake/gcc-12.3.0/cmake-3.26.3-irjkhymv5xk265cv6x4hmkppiwxps2zx/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Python3 (missing: Python3_INCLUDE_DIRS Development.Module)
  (found suitable version "3.11.4", minimum required is "3.8")
Call Stack (most recent call first):
  /opt/spack/opt/spack/linux-ubuntu23.04-skylake/gcc-12.3.0/cmake-3.26.3-irjkhymv5xk265cv6x4hmkppiwxps2zx/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /opt/spack/opt/spack/linux-ubuntu23.04-skylake/gcc-12.3.0/cmake-3.26.3-irjkhymv5xk265cv6x4hmkppiwxps2zx/share/cmake-3.26/Modules/FindPython/Support.cmake:3766 (find_package_handle_standard_args)
  /opt/spack/opt/spack/linux-ubuntu23.04-skylake/gcc-12.3.0/cmake-3.26.3-irjkhymv5xk265cv6x4hmkppiwxps2zx/share/cmake-3.26/Modules/FindPython3.cmake:551 (include)
  /opt/spack/opt/spack/linux-ubuntu23.04-skylake/gcc-12.3.0/paraview-master-qcntndw63a5lwzlidmfwgwlyv2xvagmu/lib/cmake/paraview-5.12/vtk/VTK-vtk-module-find-packages.cmake:1102 (find_package)
  /opt/spack/opt/spack/linux-ubuntu23.04-skylake/gcc-12.3.0/paraview-master-qcntndw63a5lwzlidmfwgwlyv2xvagmu/lib/cmake/paraview-5.12/vtk/vtk-config.cmake:159 (include)
  /opt/spack/opt/spack/linux-ubuntu23.04-skylake/gcc-12.3.0/paraview-master-qcntndw63a5lwzlidmfwgwlyv2xvagmu/lib/cmake/paraview-5.12/paraview-config.cmake:199 (find_package)
  CMakeLists.txt:8 (find_package)

The problem here is that the FIndPackage(Python3 REQUIRED) inside ParaView/VTK finds the Python3.11 executable which does not have the required component instead of finding the Spack installed version of Python. This is strange because the same command is ran when installing ParaView and it finds the correct Python (i.e the Spack installed one).

I found a workaround by specifying:

cmake_policy(SET CMP0094 NEW)
find_package(Python3 REQUIRED)

in the Themys CMakeLists.txt before the find_package(ParaView REQUIRED) command.

Is this workaround legit or is there something else to do?

Hereafter you can find an archive with a DockerFile and a spack environment that reproduce the problem.
Extract it, run docker build, it will take some time to build. Once done, run the container and inside the container please type:

cd /opt
source spack/share/spack/setup-env.sh
spack env activate themys_env
spack install

Reproduce_PV_Policy_Transmission_Issue.tar.bz2 (20.3 KB)

Thanks

I confirm the issue and I reproduce it with the ParaView-superbuild

Hi @guillaume_Peillex

I confirm the your workaround is perfectly acceptable.
I’ve found the right fix in VTK and will fix it soon. It is actually close to your workaround.

Best,

https://gitlab.kitware.com/vtk/vtk/-/merge_requests/10849

Thanks a lot @mwestphal !