Fou89
Fou89

Reputation: 21

Installing MayaVi on Windows, working with Python 2.7

I am trying to install the MayaVi package using pip, but I keep getting an error message saying (ImportError: No module named vtk). How do I fix this problem? So on command prompt: $pip install mayavi output File "Tvtk\code_gen.py", line 10, in import vtk ImportError: No module named vtk

Upvotes: 2

Views: 5181

Answers (2)

Ezekiel Kruglick
Ezekiel Kruglick

Reputation: 4686

This has actually gotten a lot easier with the new wheel format and installation.

Make sure your python setup is wheel compatible (e.g. upgrade pip and 'pip install wheel') - you may need to google around for how to do that for certain distributions like Canopy.

Then just grab either the VTK and MAYAVI wheels or the MAYAVI+VTK wheel from the inestimable http://www.lfd.uci.edu/~gohlke/pythonlibs/#vtk

Right now for example you might choose: mayavi‑4.4.0+vtk610‑cp27‑none‑win32.whl (assuming 32 bit install of cpython 2.7, the filenames encode important stuff and there are many options)

Then run pip install mayavi‑4.4.0+vtk610‑cp27‑none‑win32.whl

I just had the occasion to do this on a laptop that I hadn't set up with Mayavi yet and it ran smooth as silk and installed everything I needed without complaint. That was several steps smoother than the last time I had to install Mayavi on a windows machine.

Upvotes: 3

arcsum
arcsum

Reputation: 156

From my recent experience, one possible reason is that vtk for windows is not installed prior to using mayavi.

however you can't do pip install vtk.

you can get vtk from here

also, remember to configure VC Express 2008 and Windows 7 SDK + .NET 3.5 to avoid additional errors.

Upvotes: 1

Related Questions