[vtkusers] Python Bindings on OSX?

Sensei senseiwa at gmail.com
Mon Jul 19 09:07:00 EDT 2010


On Jul 14, 2010, at 6:23pm, Eric E. Monson wrote:

> Just as a bit of followup info -- when you do an install the .so files end up in the VTK egg in /Library/Python/2.6/site-packages/VTK.../vtk, and they should contain internal paths to the ...PythonD.dylib libraries if you've built with VTK_USE_RPATH: ON (on my machine they refer back to the ones in the build/bin directory). You can check them with "otool -L path/to/libvtkCommonPython.so".
> 
> If all of these internal paths are correct, and the egg has been installed in the correct place, then you shouldn't have to modify the PYTHONPATH or DYLD_LIBRARY_PATH to get "import vtk" to work. If you don't want to build with RPATH ON for some reason, then the library path env variable setting is probably necessary to find the .dylib libraries.

Hi again!

I successfully built VTK with VTK_USE_RPATH=ON, but a new problem is troubling me. When running mayavi, python complains about a VTK library. Unfortunately, I can't find it anywhere:


<shell>
$ mayavi
Traceback (most recent call last):
  File "/usr/local/bin/mayavi", line 317, in <module>
    app = MayaViTkGUI (r)
  File "/Library/Python/2.6/site-packages/mayavi/Main.py", line 1009, in __init__
    self.renwin = Misc.RenderWindow.RenderWindow (self.renwin_frame)
  File "/Library/Python/2.6/site-packages/mayavi/Misc/RenderWindow.py", line 89, in __init__
    height=505)
  File "/Library/Python/2.6/site-packages/VTK-5.4.2-py2.6.egg/vtk/tk/vtkTkRenderWidget.py", line 81, in __init__
    vtkLoadPythonTkWidgets(master.tk)
  File "/Library/Python/2.6/site-packages/VTK-5.4.2-py2.6.egg/vtk/tk/vtkLoadPythonTkWidgets.py", line 65, in vtkLoadPythonTkWidgets
    interp.call('load', filename)
_tkinter.TclError: dlopen(libvtkRenderingPythonTkWidgets.dylib, 10): image not found
</shell>

The dynamic library is no where to be found on my system and in the VTK build directory:
$ find ~/Downloads/VTK -name "libvtkRenderingPythonTkWidgets.*"
$ find /Library/Python/2.6/ -name "libvtkRenderingPythonTkWidgets.*"


However, being curious, I ran otool on the VTK main library as you suggested:

<shell>
$ cd /Library/Python/2.6/site-packages/VTK-5.4.2-py2.6.egg/vtk

$ otool -L libvtkCommonPython.so 
libvtkCommonPython.so:
	/Users/sensei/Downloads/VTK/bin/libvtkCommonPythonD.5.4.dylib (compatibility version 5.4.0, current version 5.4.2)
	/System/Library/Frameworks/Python.framework/Versions/2.6/Python (compatibility version 2.6.0, current version 2.6.1)
	/Users/sensei/Downloads/VTK/bin/libvtkCommon.5.4.dylib (compatibility version 5.4.0, current version 5.4.2)
	/Users/sensei/Downloads/VTK/bin/libvtksys.5.4.dylib (compatibility version 5.4.0, current version 5.4.2)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 123.0.0)
	/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
</shell>

Why does it point to my build directory?And why can't I find that "libvtkRenderingPythonTkWidgets.dylib" library?

I'm starting to hate python-esque errors! :)

Cheers & thanks!


More information about the vtkusers mailing list