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
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.
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.
Related
I've been trying for a couple of hours already. It seems IDLE can't find any third-party module. I am a Python beginner.
Here is some info about my system:
OSX version: 10.11.5
python version: Python 2.7, Python 3.4, Python 3.5
The initial installation using pip (among other methods) seems to work fine. When I repeat the installation, terminal responds with:
Requirement already satisfied (use --upgrade to upgrade): pyperclip in
./anaconda/lib/python3.4/site-packages
However, when I go to IDLE (Python 3.4) and try to import the module, IDLE responds with:
Traceback (most recent call last): File "", line 1, in
import pyperclip ImportError: No module named 'pyperclip'
I have read that it may have something to do with my PATH or some virtual environment. I’ll be frank, I’m not sure what to make of these as they seem beyond my current ability.
This inability to import modules is becoming an almost insurmountable roadblock to advancing with Python. If you can offer any ideas on what I can do or can ELI5 the solution, I am forever in your debt?
It seems you are using conda, but you are trying to install the pyperclip module with pip. Have you tried running conda install pyperclip?
As stated here:
Because Conda introduces a new packaging format, you cannot use pip and Conda interchangeably; pip cannot install the Conda package format. You can use the two tools side by side but they do not interoperate either.
I've just installed Python 3.5 to experience its functionality. The problem is that all the modules I use in my daily programming have been installed and run very well on it except Matplotlib. I installed it via pip and never faced any errors while installing, but when I wanted to import it, the error saying, DLL load failed: The specified module could not be found. popped up.
What's the matter with Python 3.5, or Matplotlib?
Uninstall the module using pip uninstall matplotlib then install it again using http://matplotlib.org/downloads.html
Obtain the .exe file that best fits your machine, in my case it would be matplotlib-1.4.3.win-amd64-py3.4.exe. This will be a more complete version of matplotlib for windows rather than using pip.
I would also consider rolling back to Python 3.4 unless you absolutely need 3.5. There shouldn't be a compatibility issue between 3.4 and 3.5 for Python, but as far as matplotlib it's been tested with 3.4, but if you run through problems on 3.5 I would roll back.
If you have Python 3.5 you should install MS's Redistributable DLLs to make matplotlib working on Windows... In my case, no need to reinstall matplotlib even...
Try this example without. If error appears install that and try with it (you must log in MS site and download version for arch you using - i tested x86 only, Windows 7, Python 3.5).
That case is included in matplotlib install documentation!
Remember, you should always read documentation before you ask!
I was trying to use the lmfit package for doing nonlinear least squares fit and I notices that the Canopy curated version is really old and doesn't have most of the objects. So I followed the instructions here https://support.enthought.com/entries/23389761 as I have done before no problem:
pip install --upgrade setuptools
pip install --upgrade lmfit
Now when I execute the same exact code some "import" statements (I suppose those involved with scimath) give:
ImportError: cannot import name scimath
Seems python standard library imports are fine e.g. import os.
I'm on Ubuntu Linux 14 with Canopy 1.5.2
What happened and how can I fix it and avoid breaking it again.
I solved the problem but I am still not sure why this occurred originally. I went into the package manager and uninstalled scimath reinstalled it and did explicit kernel restarts on my IPython notebooks and interpreters. This fixed it but I don't see why unless somehow the scimath installation was corrupted. Before that I tried restarting application, computer, and reinstalling canopy.
I installed sci-kit learn with the installer scikit-learn-0.13.1.win32-py2.7.exe but when I try to call it in Canopy and iPython I get the following error: "ImportError: No module named sklearn".
I tried the following solutions found online but non of them work
Running python setup.py install in the directory and got this error: "ImportError: no module named sklearn._build_utils"
Tried pip install - U scikit-learn but the download keeping on timing out
Tried easy_install - U scikit-learn but the download also kept on timing out
I'm wondering if it is because I am using Canopy (Free version) and I should maybe uninstall it and install all my packages again using vanilla Python.
Thanks.
Have you tried adding sklearn to your python path manually? Have a look at this thread, it might help!
How to add to the pythonpath in windows 7?
I'm using Mac OS X 10.6.8. I installed Python 2.6 using the binary installer in http://www.python.org/. I've been using it along with SciPy and Matplotlib for my scientific computing needs since March 2011 without any problems. Recently, I have the need for the matplotlib library called Basemap.
I followed this article on https://modelingguru.nasa.gov/docs/DOC-1847. It states that the easiest way to install the Basemap library is through Macports (or Fink). So I tried to install Basemap via Macports. I executed the command
port install py-matplotlib-basemap
and it seems to install so many things such as Python 2.4, etc. So to be specific, I used Macports again but this time using
port install py26-matplotlib-basemap
since I'm using Python 2.6. The installation didn't seem to have any problems.
Now I tested if Basemap was properly installed by running a Python code example that uses basemap for graphing. But the terminal says the following before coming back to the prompt:
Traceback (most recent call last):
File "basemap-test.py", line 1, in <module>
from mpl_toolkits.basemap import basemap
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mpl_toolkits/basemap/__init__.py", line 45, in <module>
import _geoslib, netcdftime
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/_geoslib.so, 2): Symbol not found: _GEOSArea
Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/_geoslib.so
Expected in: dynamic lookup
What may be wrong here? I know that Macports installs its own Python version, I don't know if that has an effect on this problem.
As you noted, MacPorts installs its own Python version (by default, at /opt/local/bin/python2.6). If you install a Python package via MacPorts, like basemap, you normally will need to run everything under the MacPorts Python. Don't try to mix and match Python instances. Packages that include C extension modules or depend on other packages which include C libraries have to be built in a way that is compatible with the way the Python interpreter was built. The Python 2.6 installers from python.org are 32-bit-only and built to be compatible with a range of OS X versions. By default, what MacPorts builds will be 64-bit on 10.6, if possible, and only tailored for 10.6 systems. The safest and easiest option long term would be to switch to using the MacPorts Python, ensuring that all the packages you need are installed from MacPorts.