[vtkusers] VTK and Python on OS X El Capitan
Eric Nodwell
eric.nodwell at numerics88.com
Tue Oct 6 07:53:08 EDT 2015
For VTK 6.3.0 in OS X 10.11 El Capitan, if you are compiling VTK
yourself, it is no longer possible to link against the system python.
This is due to the new System Integrity Protection. The system python
is a protected location in OS 10.11, and SIP is very strict about what
can be linked, and how, to restricted programs. Although the build
will succeed, this is what happens when you attempt to load VTK in
python:
$ python
Python 2.7.10 (default, Aug 22 2015, 20:33:39)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/Shared/install/vtk-6.3.0/lib/python2.7/site-packages/vtk/__init__.py",
line 39, in <module>
from vtkCommonCore import *
File "/Users/Shared/install/vtk-6.3.0/lib/python2.7/site-packages/vtk/vtkCommonCore.py",
line 1, in <module>
from vtkCommonCorePython import *
ImportError: dlopen(/Users/Shared/install/vtk-6.3.0/lib/python2.7/site-packages/vtk/vtkCommonCorePython.so,
2): Library not loaded: libvtkCommonCorePython27D-6.3.1.dylib
Referenced from:
/Users/Shared/install/vtk-6.3.0/lib/python2.7/site-packages/vtk/vtkCommonCorePython.so
Reason: unsafe use of relative rpath
libvtkCommonCorePython27D-6.3.1.dylib in
/Users/Shared/install/vtk-6.3.0/lib/python2.7/site-packages/vtk/vtkCommonCorePython.so
with restricted binary
The easiest solution is to use python from python.org . For those
unsure, here are the relevant CMake variables to build VTK against the
python.org python (if multiple pythons are installed, CMake tends to
find the system python libraries):
PYTHON_EXECUTABLE
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
PYTHON_INCLUDE_DIR
/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
PYTHON_LIBRARY
/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib
Eric
More information about the vtkusers
mailing list