ImportError: dynamic module does not define init function

Hi all,

I have been working on setting up blender to import Paraview simulations via *.x3d (I don’t want a static scene so I’m using a third-party script: http://www.ualberta.ca/CNS/RESEARCH/Vis/VTKBlender/VTKBlender.py). I think I have all the env. variables configured correctly in ~/.bashrc however when I execute the script in blender I get this in the console:

File “/vtk_to_blender.py”, line 3, in <module>
File “/home/nabil/Documents/VTK-6.1.0/Wrapping/Python/vtk/init.py”, line 39, in <module>
from vtkCommonCore import *
File “/home/nabil/Documents/ParaView-4.1.0-Linux-64bit/lib/paraview-4.1/site-packages/vtk/vtkCommonCore.py”, line 1, in <module>
from vtkCommonCorePython import *
ImportError: dynamic module does not define init function (PyInit_vtkCommonCorePython)

I have compiled VTK from source and Paraview was simply a tarball from their site.

What is the problem?? :confused:

-Nabil

the problem is not so clear but if you your gcc and g++ version are 5.4 or less , vtk will not work and all other libraries that uses VTK as well

i am working on the same project : implementing a way for volumetric mesh in blender but i fixed this issue , i will share the code once i finish.

solution is to install newer gcc and g++ follow below steps:

sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install g++-7 -y

#Set it up so the symbolic links gcc, g++ point to the newer version:

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 \
                         --slave /usr/bin/g++ g++ /usr/bin/g++-7 
sudo update-alternatives --config gcc
gcc --version
g++ --version