[vtkusers] No module named vtk when installing mayavi

Ben Boeckel ben.boeckel at kitware.com
Fri Aug 21 11:45:55 EDT 2015


On Fri, Aug 21, 2015 at 10:30:41 +0200, KIM TRAN DONG wrote:
> I'm using Mac 10.9 Maverick on vmware 11, and I want to install VTK for

...

> I set path in .bash_profile like this:
> export LD_LIBRARY_PATH=/usr/local/VTKBuild/lib:${LD_LIBRARY_PATH}

Only makes sense on Linux, so you don't need this.

> export
> PYTHONPATH=/usr/local/VTKBuild/Wrapping/Python/vtk:/usr/local/VTKBuild/Wrapping/Python:$PYTHONPATH

This looks wrong (or at least incomplete). The Wrapping/Python directory
is where the sources for the wrappers get created.

> export PATH=/usr/local/VTKBuild/bin:$PATH
> 
> Everything seems ok:
> 
> $vtkpython
> vtk version 6.3.0
> Python 2.7.5 (default, Mar  9 2014, 22:15:05)
> [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from vtk import *
> >>> vtk
> <module 'vtk' from '/usr/local/VTKBuild/Wrapping/Python/vtk/__init__.pyc'>
> >>>

Try inspecting sys.path from vtkpython. I suspect there is another
directory you are missing in your PYTHONPATH.

> But when I install mayavi-4.4.3, I get this error (entier message in
> attached file):
>   ....
>   File "tvtk/code_gen.py", line 10, in <module>
>     import vtk
> ImportError: No module named vtk
> 
> I also get this message when typing 'import vtkpython' in python:
> 
> $ python
> Python 2.7.5 (default, Mar  9 2014, 22:15:05)
> [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import vtkpython
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: No module named vtkpython

The module is 'vtk', not 'vtkpython'.

> By the way, I have this lines when I open a terminal, I don't know if it
> has any effects on the bash?:
> -bash: Desktop: command not found
> -bash: Desktop: command not found
> -bash: Desktop: command not found
> -bash: Desktop: command not found
> -bash: Desktop: command not found

You probably have a space in your path? Hard to tell where this is
coming from. Try running `bash -x` to see what the command line causing
this is. That should make it easier to find.

--Ben


More information about the vtkusers mailing list