I have recently encountered a
TypeError when trying to import some modules from
paraview.simple. I am trying to import these modules form an Anaconda environment with python 3.9.16. It can be reproduced as follows:
>>> import paraview.simple Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/kieran/anaconda3/envs/shapeopt/lib/python3.9/site-packages/paraview/simple.py", line 41, in <module> from paraview import servermanager File "/home/kieran/anaconda3/envs/shapeopt/lib/python3.9/site-packages/paraview/servermanager.py", line 3255, in <module> if not vtkInitializationHelper.Initialize(slist, ptype): TypeError: arguments do not match any overloaded methods
I installed paraview from conda-forge, but have also tried installing from source and appending to the PYTHONPATH.
Running on Ubuntu 20.04.6.
Edit to add: I have narrowed this down to a conflict somewhere with the
vtk python package, which gets installed when I install
pyvista as part of another dependency. I have found the following workaround:
- I install all of my required packages
pip uninstall vtk
- in the python interpreter/script, before importing
import vtk, which will overload the vtk namespace with the vtk python package included in the ParaView distribution (in
After this, I am able to import
paraview.simple as desired and retain all functionality.