Search code examples
pythonimportpackageenthoughtmayavi

import module error Python


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


Solution

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

    from mayavi import mlab