3

I installed pyvista on my laptop with Ubuntu (version 22) by using the command pip install pyvista. But when I import pyvista, it gives the following error.

ImportError: cannot import name 'vtkExtractEdges' from 'vtkmodules.vtkFiltersExtraction' (/home/ifti/.local/lib/python3.10/site-packages/vtkmodules/vtkFiltersExtraction.cpython-310-x86_64-linux-gnu.so)

What is wrong and how can I fix this?

Mota Mota
  • 53
  • 1
  • 5

1 Answers1

4

Update: Python 3.10 + VTK 9.2.0(rc1) compatibility has been fixed in PyVista release 0.34.2, please update pyvista to get things to work again. Pre-0.34.2 answer below.


There is a version issue here. Firstly, you are on Python 3.10, and the only VTK version that's available on PyPI is the new 9.2.0 release candidate:

$ pip install vtk==
ERROR: Could not find a version that satisfies the requirement vtk== (from versions: 9.2.0rc1)
ERROR: No matching distribution found for vtk==

So you get the newest VTK, but the newest VTK has moved around a few things, breaking old imports. There is a recent pull request that fixes this on the PyVista side, but this was added in May, and we haven't had a PyVista release since then. There are also additional things that will break with the VTK 9.2.0 release, which still need fixing.

So there are two things you can do: either downgrade to Python 3.9, and use VTK 9.1.0 or older, or wait a bit until we publish a new PyVista release. Considering this breakage on Python 3.10 there will definitely be a new release very soon. I'll open an issue about this.

  • 1
    We'll fix this soon. End of the month at the worst, this weekend if we're lucky. – Alex Kaszynski Jun 25 '22 at 20:51
  • Thanks Andras for the information. With a little more search on the internet, I found this https://github.com/banesullivan/transform-2021 very helpful and was successful to install pyvista in a separate conda environment. – Mota Mota Jun 27 '22 at 17:45
  • @MotaMota we've released PyVista version 0.34.2 which should work with Python 3.10. If you update PyVista things should be working again. Please let us know if anything breaks again/still. – Andras Deak -- Слава Україні Jun 30 '22 at 11:34
  • 1
    @AndrasDeak--СлаваУкраїні, I have upgraded pyvista by using the command pip3 install --upgrade pyvista. it is working fine, in case some errors or bugs appear I will notify you. Thanks – Mota Mota Jul 04 '22 at 08:51