Question

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

Was it helpful?

OTHER TIPS

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.

I was able to get Mayavi2 to work with Python 3.6.4.

To set up Mayavi on ubuntu, do the following -

  • Install Anaconda/Miniconda distribution of python depending on your needs(I used Miniconda 4.3.30). For more info look here
  • Run the following in terminal -

        apt-get install -y libglib2.0-0 libxext6 libsm6 libxrender1 gtk3.0
        conda install -y -c conda-forge qt vtk pyvtk pyside envisage mesalib mayavi
        conda install -y -c ajsrk traitsui
    

    Ideally , you wouldn't need the last line since traitsui will be installed as part of the dependencies in the previous step. However, I found an issue with this version of traitsui. So as a temporary fix, I have uploaded my version of traitsui into anaconda cloud; this can be used until the fix finds its way into the next release and is available in the conda-forge channel

To verify the installation start a terminal session and type 'mayavi2'

The best solution that I`ve found, is this. Even though, Mayavi will only work on Pyathon 3.5...

My solution is launching Spider from Anaconda 3 and then running the file mayavi2-script.py that can be found in the directory Anaconda/Scripts. It launches the 3D data visualizer as a pop-up window in Windows10.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top