ParaView Python Version

Hi there,

I’m in the process of upgrading tomviz to the latest ParaView.

Previously, we would read these cmake definitions to get the python dependencies:


But I see that they do not exist anymore. Is there a way to get these with the latest ParaView? We want to make sure we use the same python that ParaView does.


The VTK::Python target has the python library in use. It looks like we should probably export VTK_PYTHON_VERSION or something like that from vtk-config.cmake so that the executable can be found as well.

Do you know if I can get the python library and include directory into cmake variables by using get_target_property() on VTK::Python?

There’s a Python${VTK_PYTHON_VERSION}::Python target. But since VTK_PYTHON_VERSION is missing… Though Python${VTK_PYTHON_VERSION}_VERSION should be in-scope.

Yeah, let’s just export VTK_PYTHON_VERSION from vtk-config.cmake. That should allow everything to be accessible without having to spell it all out manually in VTK. Documentation should indicate how to get this.

Okay. Well, I got the cmake variables from the ParaView cache using the method on the right side here:

Let me know if there is a simpler way to do it.

That may be inaccurate. I recommend that if you’re asking ParaView’s build tree that you use PARAVIEW_PYTHON_VERSION since VTK_PYTHON_VERSION is set locally based on it. But, I recommend that that code disappear once VTK provides this variable.