Question

I try to import mlab in mayavi with Enthought distribution. It fails with

 from enthought.mayavi import mlab

and also with

 import enthought.mayavi
 from enthought.mayavi import mlab

So I had an idea maybe init.py in package mayavi (empty) was to be added with

 import mlab

but now the previous command raise exception with error

 Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    import enthought.mayavi
 File "C:\Python27\lib\site-packages\enthought\mayavi\__init__.py", line 1, in <module>
import mlab
  File "C:\Python27\lib\site-packages\enthought\mayavi\mlab.py", line 3, in <module>
    from mayavi.mlab import *
ImportError: No module named mayavi.mlab

Some thead I have found mentions that vtk could be root cause for this precise mlab import issue. I had vtk installed with Tcl-Tk Installer. But actually, enthought distribution already include some tvtk package. I added tvtk location to PYTHONPATH.

This is still not working.

Any idea about how to fix import issue of this kind? Or any comment related to use of enthought mlab (may require known work around)?

Thanks and regards

Was it helpful?

Solution 2

Uninstalled Enthought distribution and installed python(x,y) last distribution. This is now working perfectly with

from mayavi import mlab

OTHER TIPS

I solved this for myself on Ubuntu 12.04 by installing the package mayavi2

sudo apt-get install mayavi2

Then this import incantation worked:

from mayavi.mlab import contour_surf

Now I just have to remember how to use it!

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