[vtkusers] Python Bindings on OSX?
David Gobbi
david.gobbi at gmail.com
Wed Jul 21 09:10:37 EDT 2010
Again, I cannot offer insight into the RPATH or install issues, but I
can give some more information about
ibvtkRenderingPythonTkWidgets.dylib. This library is not a not a
typical library, it is actually a loadable Tk module. For it to be
loaded, it must be placed somewhere it either Python's module path, or
somewhere in Tcl's module path. The RPATH has no effect on whether
this particular library is loaded, since python loads it manually.
The best place for it to be installed is wherever the python .so files
are installed. If it is put in with the .so files, then it should be
loaded when it is needed.
David
On Wed, Jul 21, 2010 at 6:11 AM, Sensei <senseiwa at gmail.com> wrote:
>
> On Jul 19, 2010, at 3:21pm, David Gobbi wrote:
>
>
>> I'll leave the RPATH questions for someone else, but I can answer the
>> libvtkRenderingPythonTkWidgets.dylib questions. This library is
>> needed so that VTK can use Python's Tkinter module, which is needed
>> for MayaVi.
>>
>> On OS X 10.6, Tkinter (and Tk) use Cocoa (on OS X 10.5, they use
>> Carbon). VTK did not support building
>> libvtkRenderingPythonTkWidgets.dylib with Cocoa until VTK 5.6. So if
>> you build VTK 5.4 on OS X 10.6, you won't get the
>> libvtkRenderingPythonTkWidgets.
>
>
> Thanks for the pointer! However, I cannot run MayaVi because the libvtkRenderingPythonTkWidgets.dylib is still missing (VTK 5.6).
>
> My configuration for VTK is BUILD_SHARED_LIBS=ON, VTK_WRAP_PYTHON=ON, VTK_WRAP_TCL=ON, VTK_USE_RPATH=ON, but then again:
>
> $ 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.6.0-py2.6.egg/vtk/tk/vtkTkRenderWidget.py", line 81, in __init__
> vtkLoadPythonTkWidgets(master.tk)
> File "/Library/Python/2.6/site-packages/VTK-5.6.0-py2.6.egg/vtk/tk/vtkLoadPythonTkWidgets.py", line 69, in vtkLoadPythonTkWidgets
> interp.call('load', filename)
> _tkinter.TclError: dlopen(libvtkRenderingPythonTkWidgets.dylib, 10): image not found
>
>
> And surprisingly, the very same library you pointed out is NOT installed:
>
> $ find /Library/Python -name libvtkRenderingPythonTkWidgets.dylib
> (NO OUTPUT)
>
> Although that library IS present in the VTK build dir:
>
> $ ls bin/libvtkRenderingPythonTkWidgets.*
> bin/libvtkRenderingPythonTkWidgets.5.6.0.dylib*
> bin/libvtkRenderingPythonTkWidgets.5.6.dylib@
> bin/libvtkRenderingPythonTkWidgets.dylib@
>
>
> The funny stuff is this: without RPATH, I get a library path problem (image of python-common not found), with RPATH on I get this Tk problem (even with VTK 5.6), and probably I miss the point of relative paths, since the python common library has absolute paths in it:
>
> $ otool -L /Library/Python/2.6/site-packages/VTK-5.6.0-py2.6.egg/vtk/libvtkCommonPython.so
> /Library/Python/2.6/site-packages/VTK-5.6.0-py2.6.egg/vtk/libvtkCommonPython.so:
> /Users/sensei/Downloads/VTK/bin/libvtkCommonPythonD.5.6.dylib (compatibility version 5.6.0, current version 5.6.0)
> /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.6.dylib (compatibility version 5.6.0, current version 5.6.0)
> /Users/sensei/Downloads/VTK/bin/libvtksys.5.6.dylib (compatibility version 5.6.0, current version 5.6.0)
> /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)
>
>
> I am puzzled... I am attaching some parts of CMakeCache.txt, maybe I am missing some obvious point!
>
> Cheers!
>
>
>
>
> //Build Verdict with shared libraries.
> BUILD_SHARED_LIBS:BOOL=ON
>
> //Install path prefix, prepended onto install directories.
> CMAKE_INSTALL_PREFIX:PATH=/usr/local
>
> //The product will be built against the headers and libraries located
> // inside the indicated SDK.
> CMAKE_OSX_SYSROOT:PATH=/Developer/SDKs/MacOSX10.6.sdk
>
> //Value Computed by CMake
> CMAKE_PROJECT_NAME:STATIC=VTK
>
> //Add module vtkChartsPython
> PYTHON_ENABLE_MODULE_vtkChartsPython:BOOL=ON
>
> //Add module vtkCommonPython
> PYTHON_ENABLE_MODULE_vtkCommonPython:BOOL=ON
>
> //Add module vtkFilteringPython
> PYTHON_ENABLE_MODULE_vtkFilteringPython:BOOL=ON
>
> //Add module vtkGenericFilteringPython
> PYTHON_ENABLE_MODULE_vtkGenericFilteringPython:BOOL=ON
>
> //Add module vtkGeovisPython
> PYTHON_ENABLE_MODULE_vtkGeovisPython:BOOL=ON
>
> //Add module vtkGraphicsPython
> PYTHON_ENABLE_MODULE_vtkGraphicsPython:BOOL=ON
>
> //Add module vtkHybridPython
> PYTHON_ENABLE_MODULE_vtkHybridPython:BOOL=ON
>
> //Add module vtkIOPython
> PYTHON_ENABLE_MODULE_vtkIOPython:BOOL=ON
>
> //Add module vtkImagingPython
> PYTHON_ENABLE_MODULE_vtkImagingPython:BOOL=ON
>
> //Add module vtkInfovisPython
> PYTHON_ENABLE_MODULE_vtkInfovisPython:BOOL=ON
>
> //Add module vtkRenderingPython
> PYTHON_ENABLE_MODULE_vtkRenderingPython:BOOL=ON
>
> //Add module vtkViewsPython
> PYTHON_ENABLE_MODULE_vtkViewsPython:BOOL=ON
>
> //Add module vtkVolumeRenderingPython
> PYTHON_ENABLE_MODULE_vtkVolumeRenderingPython:BOOL=ON
>
> //Add module vtkWidgetsPython
> PYTHON_ENABLE_MODULE_vtkWidgetsPython:BOOL=ON
>
> //Add module vtkChartsPython shared
> PYTHON_MODULE_vtkChartsPython_BUILD_SHARED:BOOL=ON
>
> //Add module vtkCommonPython shared
> PYTHON_MODULE_vtkCommonPython_BUILD_SHARED:BOOL=ON
>
> //Add module vtkFilteringPython shared
> PYTHON_MODULE_vtkFilteringPython_BUILD_SHARED:BOOL=ON
>
> //Add module vtkGenericFilteringPython shared
> PYTHON_MODULE_vtkGenericFilteringPython_BUILD_SHARED:BOOL=ON
>
> //Add module vtkGeovisPython shared
> PYTHON_MODULE_vtkGeovisPython_BUILD_SHARED:BOOL=ON
>
> //Add module vtkGraphicsPython shared
> PYTHON_MODULE_vtkGraphicsPython_BUILD_SHARED:BOOL=ON
>
> //Add module vtkHybridPython shared
> PYTHON_MODULE_vtkHybridPython_BUILD_SHARED:BOOL=ON
>
> //Add module vtkIOPython shared
> PYTHON_MODULE_vtkIOPython_BUILD_SHARED:BOOL=ON
>
> //Add module vtkImagingPython shared
> PYTHON_MODULE_vtkImagingPython_BUILD_SHARED:BOOL=ON
>
> //Add module vtkInfovisPython shared
> PYTHON_MODULE_vtkInfovisPython_BUILD_SHARED:BOOL=ON
>
> //Add module vtkRenderingPython shared
> PYTHON_MODULE_vtkRenderingPython_BUILD_SHARED:BOOL=ON
>
> //Add module vtkViewsPython shared
> PYTHON_MODULE_vtkViewsPython_BUILD_SHARED:BOOL=ON
>
> //Add module vtkVolumeRenderingPython shared
> PYTHON_MODULE_vtkVolumeRenderingPython_BUILD_SHARED:BOOL=ON
>
> //Add module vtkWidgetsPython shared
> PYTHON_MODULE_vtkWidgetsPython_BUILD_SHARED:BOOL=ON
>
> //Build classes using Carbon API.
> VTK_USE_CARBON:BOOL=OFF
>
> //Build pixel and vertex shader support for Cg.
> VTK_USE_CG_SHADERS:BOOL=OFF
>
> //Build VTK chart support (OpenGL based)
> VTK_USE_CHARTS:BOOL=ON
>
> //Build classes using Cocoa API.
> VTK_USE_COCOA:BOOL=ON
>
> //Build the vtkRendering kit. Needed for displaying data or using
> // widgets.
> VTK_USE_RENDERING:BOOL=ON
>
> //Build shared libraries with rpath. This makes it easy to run
> // executables from the build tree when using shared libraries,
> // but removes install support.
> VTK_USE_RPATH:BOOL=ON
>
> //Build VTK with Tk support
> VTK_USE_TK:BOOL=ON
>
> //Wrap VTK classes into the Python language.
> VTK_WRAP_PYTHON:BOOL=ON
>
> //Wrap VTK classes into the TCL language.
> VTK_WRAP_TCL:BOOL=ON
>
>
>
>
>
>
>
>
>
>
>
More information about the vtkusers
mailing list