Issue with import vtk in Python

Hello VTK community I receive vtk import error in python when I trying to import vtk

Traceback (most recent call last):
File “/home/varga/venvs/pystn/lib/python3.7/site-packages/vtkmodules/”, line 13, in
from . import vtkCommonCore
ImportError: /home/varga/venvs/pystn/lib/python3.7/site-packages/vtkmodules/ undefined symbol: _ZNK16vtkUnicodeString8utf8_strERSs

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “”, line 983, in _find_and_load
File “”, line 967, in _find_and_load_unlocked
File “”, line 677, in _load_unlocked
File “”, line 728, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/data/home/varga/tmp/pycharm_project_200/bayessian_appearance/”, line 3, in
import vtk
File “/home/varga/venvs/pystn/lib/python3.7/site-packages/”, line 30, in
all_m = importlib.import_module(‘vtkmodules.all’)
File “/usr/lib/python3.7/importlib/”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “/home/varga/venvs/pystn/lib/python3.7/site-packages/vtkmodules/”, line 15, in
import _vtkmodules_static
ModuleNotFoundError: No module named ‘_vtkmodules_static’

I installed vtk in python 3.7 using pip, so I suppose there should not be any issues could someone help me with this?

The missing symbol is for the method vtkUnicodeString::utf8_str(std::string&), which is defined in (the C++ library). Check whether the wrappers are linking to that library:

ldd lib/python3.7/site-packages/vtkmodules/
1 Like