[vtkusers] VTK and python

David Gobbi david.gobbi at gmail.com
Fri Jul 12 16:52:36 EDT 2013


Hi Francois,

If you have more that one version of VTK installed on your system, it is
possible that the vtk-python is finding the wrong copy of the VTK libs.
Try debugging this with the "ldd" tool, e.g.

ldd /tools/Python/Python-2.7.5/lib/python2.7/site-packages/VTK-5.10.1-py2.7.egg/vtk/vtkImagingPython.so

 - David

On Fri, Jul 12, 2013 at 8:53 AM, Francois Budin <fbudin at unc.edu> wrote:
> Hello everybody,
>
> I am trying to compile VTK (5.10.1) with python (2.7.5). Everything compiles
> fine, but I cannot successfully import vtk in my python interpreter. I can
> use vtkpython that is compiled with vtk, but I would really like to be able
> to be able to use python within my normal python interpreter and within
> ipython.
> I tried to follow the instructions I found here:
> http://vtk.org/gitweb?p=VTK.git;a=blob;f=Wrapping/Python/README.txt
> I added some paths (tcsh):
> setenv PYTHONPATH
> /NIRAL/devel/linux/VTK/VTK_5.10.1_X64_static_release_QT_Python_to_be_removed_test/Wrapping/Python/:/NIRAL/devel/linux/VTK/VTK_5.10.1_X64_static_release_QT_Python_to_be_removed_test/bin/:
> setenv LD_LIBRARY_PATH
> /NIRAL/devel/linux/VTK/VTK_5.10.1_X64_static_release_QT_Python_to_be_removed_test/bin/:${LD_LIBRARY_PATH}
>
> I also ran setup.py that is in {VTK-build}/Wrapping/Python/ and this seems
> to have successfully installed vtk in my python environment. I now have a
> VTK-5.10.1-py2.7.egg/ folder in {python_path}/lib/python2.7/site-packages/
>
> However, I get the following message when I try to import vtk in python:
>>>> import vtk
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File
> "/tools/Python/Python-2.7.5/lib/python2.7/site-packages/VTK-5.10.1-py2.7.egg/vtk/__init__.py",
> line 44, in <module>
>     from vtkImagingPython import *
> ImportError:
> /tools/Python/Python-2.7.5/lib/python2.7/site-packages/VTK-5.10.1-py2.7.egg/vtk/vtkImagingPython.so:
> undefined symbol: PyVTKAddFile_vtkImageSpatialFilter
>
>
> I still get the same issue after running the install rule for VTK in a
> specific folder (not the system folder because of permission issues).
>
> Do anybody knows if I should add something else to my PATH or what could be
> wrong?
>
> Sincerely,
>
> Francois



More information about the vtkusers mailing list