Reputation: 26333
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
Upvotes: 4
Views: 6936
Reputation: 1550
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!
Upvotes: 3
Reputation: 26333
Uninstalled Enthought distribution and installed python(x,y) last distribution. This is now working perfectly with
from mayavi import mlab
Upvotes: 1