ParaView Python Version

python

(Patrick Avery) #1

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:

ParaView_PYTHON_INCLUDE_DIR
ParaView_PYTHON_LIBRARY
ParaView_PYTHON_EXECUTABLE

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.

Patrick


(Ben Boeckel) #2

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.


(Patrick Avery) #3

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


(Ben Boeckel) #4

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.


(Ben Boeckel) #5

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.


(Ben Boeckel) #6

https://gitlab.kitware.com/vtk/vtk/merge_requests/5373


(Patrick Avery) #7

Okay. Well, I got the cmake variables from the ParaView cache using the method on the right side here: https://github.com/OpenChemistry/tomviz/pull/1841/files#diff-af3b638bc2a3e6c650974192a53c7291R69

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


(Ben Boeckel) #8

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.