[vtkusers] How to build and install the python wrapper properly on (rootless) MacOS 10.11

normanius juch at zhaw.ch
Sat Oct 8 07:08:29 EDT 2016


Dear community

I would like to know how to properly build the vtk module for python. In the
following, I describe how it used to work for me prior to upgrading to MacOS
10.11, and why it doesn't work for me anymore.

My system:
- Mac OS 10.11 ((rootless) El Capitan)
- python 2.7.12
- vtk-7.1.0

I generate the build project with the following command:


(Note that I need to specify PYTHON_INCLUDE_DIR and PYTHON_LIBRARY because
otherwise CMake mixes up system-python (coming with MacOS, residing in
/usr/bin and /usr/lib) and the python version I use for development
(residing in /Library/Frameworks/Python.framework/Versions/2.7/, and linking
to /usr/local/lib) - which I guess is a flaw in vtk's CMake project, because
I don't think my setup is non-standard.)

If I call  vtk is built properly and installed under
/opt/dev/versions/vtk/vtk-7.1.0-shared/. However, I won't be able to import
the vtk module in python just like this. If I try, I'd get an error like
this which is caused because not all links can be resolved:



The solution for me on MacOS used to be to extend the environment variable
DYLD_LIBRARY_PATH by "/opt/dev/versions/vtk/vtk-7.1.0-shared/lib". That way,
the links to the vtk-dylibs can be resolved and I can happily use the vtk
module in python.

Now that I am using MacOS 10.11 - this is not a recommended solution. In
10.11,  System Integrity Protection
<https://en.wikipedia.org/wiki/System_Integrity_Protection>   has been
introduced to MacOS, which aims at increasing the overall system security.
One of the consequences is that child processes only have  restricted access
<https://developer.apple.com/library/content/documentation/Security/Conceptual/System_Integrity_Protection_Guide/RuntimeProtections/RuntimeProtections.html>  
to "outside" resources, and that they don't see the DYLD_LIBRARY_PATH
variable. 

As a consequence, I won't be able to use vtk in my IDE (PyCharm), because it
always instantiates python as a child process, and above linking problem
will show up again.

So after this lengthy problem description my question goes like this: I'm
pretty sure that the DYLD_LIBRARY_PATH-trick should not be necessary. But
how to configure vtk such that a "standalone" site-package for python is
built that won't show the problem of missing resources like the one shown
above?

Many thanks!



--
View this message in context: http://vtk.1045678.n5.nabble.com/How-to-build-and-install-the-python-wrapper-properly-on-rootless-MacOS-10-11-tp5740708.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list