Get mayavi working with Python 3

Hme picture Hme · Oct 2, 2013 · Viewed 14.2k times · Source

I'm having trouble running mayavi in python 3.3

When running my program with python3 (or python3.3) i get

from mayavi import mlab as ml
ImportError: No module named 'mayavi'

To get numpy and matplotlib to work, i used:

sudo apt-get install python3-"missing module"

But the usual way to install mayavi is just

sudo apt-get install mayavi2

And python3 doesn't find it....

Does anyone know a way to get mayavi to work with Python3? Is it not supported yet?

I have tried both

import mayavi.mlab as ml
from mayavi import mlab as ml

Both give me the same error

Any clarification would be greatly appreciated :)

Answer

Riet picture Riet · Aug 15, 2016

Mayavi can work with python 3 now. You will need VTK 7.0 or higher compiled for python 3 support. Then you can just install mayavi with pip. pip install mayavi

Installing vtk may prove somewhat difficult. You need to make sure to change the PYTHONPATH variable, and build vtk with tcl, tk, and python 3 support.