[vtkusers] VTK and Python on OS X El Capitan

Eric Nodwell eric.nodwell at numerics88.com
Tue Oct 6 12:01:33 EDT 2015


Hi David,

Yes, vtkpython works just fine. Maybe I should get in the habit of using it. :)

I think the error message, although certainly related to the new
System Integrity Protection, must be misleading. As far as I can tell,
there is, as you expected, no RPATH set in vtkCommonCorePython.so
(i.e. there is no RPATH in the output of "otool -l
vtkCommonCorePython.so".) This is a wild guess, but perhaps the fact
that libvtkCommonCorePython27D-6.3.1.dylib is specified as just a file
name and not a complete path counts as an illegal relative path to
SIP??

Anyway, vtkpython works, and the official python.org works, so there
are many solutions.

Eric





On Tue, Oct 6, 2015 at 5:31 PM, David Gobbi <david.gobbi at gmail.com> wrote:
> Hi Eric,
>
> Thanks for the info.
>
> Out of curiosity, what happens when you run programs with VTK's
> own vtkpython executable?  I'm guessing that would work, since it
> isn't a "restricted binary".
>
> About the rpaths, I'm a little surprised they are still in the .so files,
> because a "make install" should clear away the rpaths unless the
> files are being installed into a bundle.
>
>  - David
>
>
> On Tue, Oct 6, 2015 at 5:53 AM, Eric Nodwell <eric.nodwell at numerics88.com>
> wrote:
>>
>> 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