Why can't I import numpy?

Can't import Numpy in Python

  • I'm trying to write some code that uses Numpy. However, I can't import it: Python 2.6.2 (r262, May 15 2009, 10:22:27) [GCC 3.4.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import numpy Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named numpy I tried the suggestions in http://stackoverflow.com/questions/233320/cannot-import-sqlite-with-python-2-6: >>> import sys >>> print sys.path ['', '/usr/intel/pkgs/python/2.6.2/lib/python26.zip', '/usr/intel/pkgs/python/2.6.2/lib/python2.6', '/usr/intel/pkgs/python/2.6.2/lib/python2.6/plat-linux2', '/usr/intel/pkgs/python/2.6.2/lib/python2.6/lib-tk', '/usr/intel/pkgs/python/2.6.2/lib/python2.6/lib-old', '/usr/intel/pkgs/python/2.6.2/lib/python2.6/lib-dynload', '/usr/intel/pkgs/python/2.6.2/lib/python2.6/site-packages'] and I searched for files named numpy in that path: $ find /usr/intel/pkgs/python/2.6.2/bin/python -iname numpy\* But nothing came up. So... Are there any other places in which Python modules are commonly installed? How can I install numpy locally in my account, if it turns out that it isn't installed in the central areas?

  • Answer:

    Have you installed it? On debian/ubuntu: aptitude install python-numpy On windows: http://sourceforge.net/projects/numpy/files/NumPy/ On other systems: http://sourceforge.net/projects/numpy/files/NumPy/ $ tar xfz numpy-n.m.tar.gz $ cd numpy-n.m $ python setup.py install

Nathan Fellman at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

Your sys.path is kind of unusual, as each entry is prefixed with /usr/intel. I guess numpy is installed in the usual non-prefixed place, e.g. it. /usr/share/pyshared/numpy on my Ubuntu system. Try find / -iname '*numpy*'

Johannes Bittner

I was trying to import numpy in python 3.2.1 on windows 7. Followed suggestions in above answer for numpy-1.6.1.zip as below after unzipping it cd numpy-1.6 python setup.py install but got an error with a statement as below unable to find vcvarsall.bat For this error I found a related question http://stackoverflow.com/questions/2817869/error-unable-to-find-vcvarsall-bat which suggested installing mingW. MingW was taking some time to install. In the meanwhile tried to install numpy 1.6 again using the direct windows installer available at this http://sourceforge.net/projects/numpy/files/NumPy/1.6.1/ the file name is "numpy-1.6.1-win32-superpack-python3.2.exe" Installation went smoothly and now I am able to import numpy without using mingW. Long story short try using windows installer for numpy, if one is available.

kunkunur

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.