[vtkusers] vtkpython imports vtk fine when run on the same install directory, but not elsewhere
William Oquendo
woquendo at gmail.com
Sat Jun 25 18:54:19 EDT 2016
To answer myself and in case anyone needs this, I fixed the problem by
appending the bin directory to the PYTHONPATH variable:
$ export PYTHONPATH=${PYTHONPATH}:/Applications/vtkpython/bin/
It is important to run the executable with absolute path,
$ /Applications/vtkpython/bin/vtkpython
since some libraries linked by this executable are relative to the actual
installation directory. This info obtained from otool:
$ otool -L /Applications/vtkpython/bin/vtkpython
/Applications/vtkpython/bin/vtkpython:
@executable_path/../lib/libvtkWrappingPython27Core-7.0.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)
@executable_path/../lib/libvtkCommonCore-7.0.1.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.1)
@executable_path/../lib/libvtksys-7.0.1.dylib (compatibility version 1.0.0,
current version 1.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version
52.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
159.1.0)
Best regards
On Sat, Jun 25, 2016 at 5:15 PM, William Oquendo <woquendo at gmail.com> wrote:
> Dear all,
> I am in Mac Os X Yosemite. Trying to fix "import vtk" errors, I downloaded
> and moved vtkpython onto /Applications. If I go to taht directory and run
> vtkpython and try to import vtk, everything works:
> $ cd /Applications/vtkpython/bin
> $ ./vtkpython
> vtk version 7.0.0
> Python 2.7.10 (default, Jul 14 2015, 19:46:27)
> [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import vtk
> No error.
> But, if run vtkpython from another directory , I get the interpreter but
> it cannot import vtk:
> $ /Applications/vtkpython/bin/vtkpython
> vtk version 7.0.0
> Python 2.7.10 (default, Jul 14 2015, 19:46:27)
> [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import vtk
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: No module named vtk
>
> BTW, the following variables are set:
> $ echo $PYTHONPATH
> :/Applications/vtkpython/lib/:/Applications/vtkpython/bin/vtk/
> $ echo $LD_LIBRARY_PATH
> :/Applications/vtkpython/lib/:/Applications/vtkpython/bin/vtk/
>
> Could you please help to fix this and be able to run vtkpython from
> outside the installation directory?
>
> Thanks in advance
>
>
> --
>
> Best regards / Cordialmente,
>
> William-Fernando Oquendo
> --------------------------
> Este correo puede carecer de tildes o eñes debido al teclado.
>
>
--
Best regards / Cordialmente,
William-Fernando Oquendo
--------------------------
Este correo puede carecer de tildes o eñes debido al teclado.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160625/5198a66d/attachment.html>
More information about the vtkusers
mailing list