vtk cannnot be loaded in python after installing python-vtk6

Bug #1354127 reported by Liren Zhu
32
This bug affects 6 people
Affects Status Importance Assigned to Milestone
vtk6 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

After installing python-vtk6, trying to import vtk in python resulting in the following error:
>>> import vtk
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/vtk/__init__.py", line 39, in <module>
    from vtkCommonCore import *
  File "/usr/lib/python2.7/dist-packages/vtk/vtkCommonCore.py", line 1, in <module>
    from vtkCommonCorePython import *
ImportError: No module named vtkCommonCorePython

file command on vtkCommanCorePython.so gives the following information:
file /usr/lib/python2.7/dist-packages/vtk/vtkCommonCorePython.so
/usr/lib/python2.7/dist-packages/vtk/vtkCommonCorePython.so: broken symbolic link to `../../../x86_64-linux-gnu/libvtkCommonCorePython27D-6.0.so'

Similar so files from libvtk6 package do exist with different names such as libvtkCommonCorePython27D-6.0.so.6.0

The .so symbol links in the vtk directory probably all have the wrong names.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in vtk6 (Ubuntu):
status: New → Confirmed
Revision history for this message
Leo Dearden (k-leo) wrote :

Thank you, Liren Zhu.

Based on your investigation, I replaced all the /usr/lib/python2.7/dist-packages/vtk/vtk*.so links, using some command line hackery which should be equivalent to:

for link in `ls /usr/lib/python2.7/dist-packages/vtk/vtk*.so`; do target=$(readlink $link).6.0; echo $link; sudo rm $link; sudo ln -s $target $link ; done

This seems to have fixed the problem for me (a VTK python example now works).

Script is believed good but not fully tested, so use at your own risk. :-)

Revision history for this message
Alex (adlinds3) wrote :

Leo, your method worked great for me. Thanks for posting!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.