5

Goal: Trying to use VTK library in Python Interpreter.

What I did: I have installed VTK using CMake with option VTK_WRAP_PYTHON and Shared_Library enabled and build the VTK in visual studio and it has finished with all builds successfully. Then I made the Python_Path.

Problem: When I try to import vtk library into python, I get the following error message:

>>> import vtk

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import vtk
  File "...\VTK\VTKvisual\Wrapping\Python\vtk\__init__.py", line 42, in <module>
    from vtkFilteringPython import *
ImportError: No module named vtkFilteringPython

Any thoughts that why this is happening?

Thanks

3 Answers 3

3

It looks like you've added the location of the VTK package directory, containing .py files such as "filtering.py" and "vtkFilteringPython.pyd", to your PYTHONPATH.

However, now you need to add both this directory and also the directory containing vtkFilteringPythonD.dll and the other DLLs to your PATH. The location of this directory depends on whether you've just run the build, or also the INSTALL target. Usually it's in "VTK\bin" or "VTK\bin\BUILDTARGET" somewhere, where BUILDTARGET is for example Debug or Release.

Sign up to request clarification or add additional context in comments.

Comments

1

Try running sudo apt-get install python-vtk

Comments

1

If you're only using the Python wrappers, right now, you can just install it from PyPI. Just do pip install vtk and you'll get the current version (which is now 8.1).

Look here for the announcement.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.