Can't import Numpy in Python
185,305
Solution 1
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
Solution 2
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*'
Solution 3
The following command worked for me:
python.exe -m pip install numpy
Solution 4
To install it on Debian/Ubuntu:
sudo apt-get install python-numpy
Related videos on Youtube
Comments
-
Nathan Fellman almost 2 years
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 this question:
>>> 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?
-
Nathan Fellman almost 15 yearsSuse 9 64-bit on a corporate machine
-
Nathan Fellman almost 15 yearsGood question. I had assumed that it's part of standard distributions.
-
Nathan Fellman almost 15 yearsHow can I install it in a private area? I don't have root permissions on the machine
-
nosklo almost 15 yearsuse the --prefix install option.
python setup.py install --prefix=/usr/intel
- see distutils docs for more details at docs.python.org/install -
Taimoor Changaiz about 9 yearsthis is the answer as the error occurs when numpy not installed in system. You have to install it using above command then you will be able to use it.
-
Noumenon almost 9 yearsModern instructions for installing on Windows: gehrcke.de/2015/02/…
-
ZF007 about 5 yearsAlthough your answer might be right you should give a little more information why this is the case because its not realy obvious why this proposed solution would work. OP's question is from 9 years ago and your answer may apply now to which version (include this type of info as well: read - dark ages vs. landing on the moon differences)?!