# VTK 8.1.2 with VTK\_WRAP\_PYTHON: Installation problem on macOS

**URL:** https://discourse.vtk.org/t/vtk-8-1-2-with-vtk-wrap-python-installation-problem-on-macos/313
**Category:** Support
**Created:** [February 24, 2019, 11:08am UTC](https://discourse.vtk.org/t/vtk-8-1-2-with-vtk-wrap-python-installation-problem-on-macos/313 "2019-02-24T11:08:36Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Romain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/romain/32/32_2.png) [@Romain](https://discourse.vtk.org/u/Romain)
#### Post date: [February 24, 2019, 11:08am UTC](https://discourse.vtk.org/t/vtk-8-1-2-with-vtk-wrap-python-installation-problem-on-macos/313/1 "2019-02-24T11:08:36Z")

</div>

Hi everyone,

I try to install VTK 8.1.2 with python support on macOS 10.14.3 (Mohaje).  
I use python 3.6.8 from anaconda, Qt 5.12.1, and the default clang obtained by XCode.  
I configure vtk like this:

> cmake .. \  
> -DVTK\_WRAP\_PYTHON=ON \  
> -DVTK\_Group\_Imaging=ON \  
> -DVTK\_Group\_Imaging=ON \  
> -DVTK\_Group\_Qt=ON \  
> -DVTK\_Group\_Rendering=ON \  
> -DVTK\_Group\_StandAlone=ON \  
> -DVTK\_Group\_Views=ON \  
> -DVTK\_Group\_Web=ON \  
> -DModule\_vtkDICOM=ON \  
> -DUSE\_GDCM=ON \  
> -DCMAKE\_INSTALL\_PREFIX=/a/path/to/my/install \  
> -DCMAKE\_MACOSX\_RPATH=ON \  
> DCMAKE\_INSTALL\_RPATH=/a/path/to/my/install/lib

The configuration and building parts work perfectly.  
I succeed to launch vtkpython directly from the building folder but once installed, I obtain this error:

> dyld: Library not loaded: @rpath/libpython3.6m.dylib  
> Referenced from: //a/path/to/my/install/bin/./vtkpython  
> Reason: image not found  
> Abort trap: 6

Does anyone what I did wrong?

Thank you,

Romain

Edit:  
I figure a way to use VTK in python (using the python executable provided by Anaconda not vtkpython):  
I added the following environment variables on my .bashrc file:

> export DYLD\_FALLBACK\_LIBRARY\_PATH=/vtk\_install\_path/lib  
> export PYTHONPATH=/vtk\_install\_path/lib/python3.6/site-packages

I have build VTK with Qt support so I need to add this variable to:

> export DYLD\_FRAMEWORK\_PATH=/vtk\_install\_path/Qt/5.12.1/clang\_64/lib

It works fine but not with the vtkpython executable. When I use otool on vtkpython I have the following dependencies:

> vtkpython:  
> @rpath/libvtkWrappingPython36Core-8.1.1.dylib (compatibility version 1.0.0, current version 1.0.0)  
> /usr/lib/libutil.dylib (compatibility version 1.0.0, current version 1.0.0)  
> @rpath/libpython3.6m.dylib (compatibility version 3.6.0, current version 3.6.0)  
> @rpath/libvtkCommonCore-8.1.1.dylib (compatibility version 1.0.0, current version 1.0.0)  
> @rpath/libvtksys-8.1.1.dylib (compatibility version 1.0.0, current version 1.0.0)  
> /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)  
> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5)

I have two questions on this:

1. Why the @rpath for vtk libraries is not something like that: @rapth/…/lib/libvtk\*.dylib?
2. Why is there a @rpath for the libpython3.6m.dylib and not the installed path?

Thank you again 🙂

Edit 2:  
I try to build with default Python (python2.7) with the same options. When I use otool on vtkpython, I obtain this time:

> vtkpython:  
> @rpath/libvtkWrappingPython27Core-8.1.1.dylib (compatibility version 1.0.0, current version 1.0.0)  
> /usr/lib/libutil.dylib (compatibility version 1.0.0, current version 1.0.0)  
> /System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.10)  
> @rpath/libvtkCommonCore-8.1.1.dylib (compatibility version 1.0.0, current version 1.0.0)  
> @rpath/libvtksys-8.1.1.dylib (compatibility version 1.0.0, current version 1.0.0)  
> /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)  
> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5)

The python library is an absolute path and vtkpython work fine.  
Unfortunately I need to use Python 3 because of other dependencies for my projects.
