Issue using Vtk with python 3.6

Hi, I have an issue when trying to read some HDF5 files using vtk, When I try to import vtk (8.2) using python : import vtk, it gives me the following error:

 Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/vtkmodules/vtkCommonCore.py", line 5, in <module>
    
from .vtkCommonCorePython import *
ImportError: libvtkCommonCorePython36D-8.2.so.1: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
  File "<stdin>", line 1, in <module> 
  File "/usr/local/lib/python3.6/site-packages/vtk.py", line 32, in <module> 
    all_spec.loader.exec_module(all_m) 
  File "/usr/local/lib/python3.6/site-packages/vtkmodules/all.py", line 7, in <module> 
    from .vtkCommonCore import * 
  File "/usr/local/lib/python3.6/site-packages/vtkmodules/vtkCommonCore.py", line 9, in <module> 
    
from vtkCommonCorePython import * 
ModuleNotFoundError: No module named 'vtkCommonCorePython'

Any help regarding that? Thank you .

It seems like the rpaths for the compiled modules are not set up properly. Is libvtkCommonCorePython36D-8.2.so.1 in /usr/local/lib? Though that should be searched for by default. You can use the LD_DEBUG=libs environment setting to tell the loader to log its search for the library at least.

Hi, friend,

Try adding the path where the VTK .sos are installed to LD_LIBRARY_PATH. This is a common option for users that don’t have root or sudo access to install them in a system path (e.g. /usr/lib64). Either this or set rpath like suggested above by setting the CMAKE_INSTALL_RPATH in CMake, then reconfigure, regenerate, rebuild and redeploy VTK.

I hope this helps,

Paulo