Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get mayavi working with Python 3

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 :)

like image 808
Hme Avatar asked Oct 02 '13 13:10

Hme


2 Answers

Today, Mayavi is not supported in python3.

  • http://www.vtk.org/Wiki/VTK/Python_Wrapping_FAQ
  • http://www.vtk.org/Wiki/VTK/Python_Wrapper_Enhancement#Python_3

See also this github issue:

https://github.com/enthought/mayavi/issues/84

like image 51
cosmoscalibur Avatar answered Oct 23 '22 03:10

cosmoscalibur


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.

like image 39
Riet Avatar answered Oct 23 '22 01:10

Riet