Cmake cannot locate VTK, VTK installation incomplete, VTK and paraview conflict

Dear all,

I’m currently using debian distribution. I encounter an issue when running cmake with a preset using cmake --preset release. I proceed to the build configuration step. However, when configuring with a preset, I see the following error:

CMake Error at scripts/cmake/BuildExternalProject.cmake:12 (find_package):
Could not find a package configuration file provided by “VTK” with any of
the following names:

VTKConfig.cmake
vtk-config.cmake

Add the installation prefix of “VTK” to CMAKE_PREFIX_PATH or set “VTK_DIR”
to a directory containing one of the above files. If “VTK” provides a
separate development package or SDK, be sure it has been installed.
Call Stack (most recent call first):
scripts/cmake/BuildExternalProject.cmake:132 (BuildExternalProject_find_package)
scripts/cmake/DependenciesExternalProject.cmake:491 (BuildExternalProject)
CMakeLists.txt:85 (include)

I think cmake is trying to find VTK (Visualization Toolkit), but it cannot locate it on my system.
This issue leads to an error when I want to configure the configuration list after using ccmake:

Configure failed with the following output

By not providing “FindVTK.cmake” in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by “VTK”, but
CMake did not find one.

Could not find a package configuration file provided by “VTK” (requested
version 9.3.0) with any of the following names:

 VTKConfig.cmake
 vtk-config.cmake

Add the installation prefix of “VTK” to CMAKE_PREFIX_PATH or set “VTK_DIR”
to a directory containing one of the above files. If “VTK” provides a
separate development package or SDK, be sure it has been installed.
Call Stack (most recent call first):
CMakeLists.txt:85 (include)

I think the problem is with finding the VTK directory and also two specific files:

  • VTKConfig.cmake
  • vtk-config.cmake

When installing VTK I also encountered this warning:

libvtk9.1 is already the newest version (9.1.0+really9.1.0+dfsg2-5).
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
python3-paraview : Conflicts: python3-vtk9 but 9.1.0+really9.1.0+dfsg2-5 is to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

There seems to be a conflict between paraview and vtk.

Kind regards,

There is. They both provide the vtk Python module. ParaView installs its VTK configuration in a subdirectory of its own. There should be a /usr/lib/*/cmake/paraview-*/vtk path you can pass as VTK_DIR to use the VTK that comes with the ParaView package. You’ll need the -dev packages to provide these files.