Go to terminal, check python version
$ python --version Python 2.7.3
Go into the Python interpreter:
$ python Python 2.7.3 (default, Apr 20 2012, 22:44:07) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information.
See if you have NumPy already installed:
>>> import numpy Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named numpyNope, it's not there, so we need to install. Exit the Python interpreter.
>>> exit()
Install NumPy using apt-get
Instead of browsing web forums and finding the right package to download and compile, just let Ubuntu's built-in package manager, apt-get, do the work:$ sudo apt-get install python-numpy python-scipyLet it have all the dependencies it wants (just type 'yes' when prompted).
See if it worked
To see if it worked, go back into the Python interpreter, import NumPy, create a NumPy array, and make sure it's a NumPy array:$ python
>>> from numpy import *
>>> type(array([1,2,4,5])) <type 'numpy.ndarray'>
Yup it worked.
Conclusion
In Ubuntu 12.04, just use apt-get to install NumPy using$ sudo apt-get install python-numpy python-scipyEverything just works.
Hi Andrew,
ReplyDeleteHow did you make those code boxes?
Check out http://alexgorbatchev.com/SyntaxHighlighter/
DeleteThis comment has been removed by the author.
ReplyDeleteWorked great thanks! But where is this installed? When i look under usr/local/lib/python2.7/ its not under sitepackages or distpackages.
ReplyDeletei dont know where to type this code"$ sudo apt-get install python-numpy python-scipy" as i'm new to ubuntu. please help me..............
ReplyDeletealos please help me in installing codeblock ide for ubuntu. i'll be your highly greateful.
thank you.
You need to type it in a terminal window. On a PC, press Ctrl-Alt-t, or open a terminal window by searching for in the program list. Then type the command you referenced.
Deletebut the problem for me I faced this message:
ReplyDeleteE: unable to locate package python-numpy
E: unable to locate package python-scipy
I am also getting same type of error..
DeleteIt's seems due to proxy i am getting this. you check yours
It wasn't so smooth for me. After I typed in the sudo apt-get install python-numpy python scipy, I typed in the followings and I got:
ReplyDeleteabcd@abcd-T3640:~$ from numpy import *
from: can't read /var/mail/numpy
What went wrong?
You need to type that line in a Python interpreter. From your output it looks like you typed it at the shell prompt. Instead, open your Python interpreter by typing the command 'python' at the shell prompt, then do your Python command.
DeleteI am facing the following message:
ReplyDeleteE : unable to locate package python-scipy
Also I tried to install pandas using the following command:
sudo easy_install pandas==0.7.3
to which the output was:
No local package or download links found for pandas==0.7.3
error : could not find suitable distribution for Requirement.parse('pandas==0.7.3)
thanks!
ReplyDeleteThis is what I'm getting.
ReplyDelete>>> sudo apt-get install python-numpy python-scipy
File "", line 1
sudo apt-get install python-numpy python-scipy
^
SyntaxError: invalid syntax
What's the problem?
You are running it on the python shell. you should exit first.
Deleteexit()
Then on the terminal type
sudo apt-get install python-numpy python-scipy
This comment has been removed by the author.
ReplyDeleteThis works for me.. Thanks andrew !
ReplyDeleteThanks a lot. It worked.
ReplyDeleteThanks a lot. :)
ReplyDelete1.
ReplyDeletepython --version
Python 2.7.2
2.
python
Python 2.7.2 (default, May 28 2013, 11:08:58)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named numpy
3. sudo apt-get install python-numpy python-scipy
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-numpy is already the newest version.
python-scipy is already the newest version.
4. sudo apt-get install python
Reading package lists... Done
Building dependency tree
Reading state information... Done
python is already the newest version.
Summary: NumPy is not found in Python interpreter but apt-get install claims all are the latest version. What to do ?
David
same error here. It says that I already have the newest version but...
Delete>>> from numpy import *
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named numpy
I got the same error also.
DeleteHow did you solve this >
Same here...
DeleteThis comment has been removed by the author.
ReplyDeleteThanks....!!!! it is working.....!!
ReplyDeleteOn "import numpy" (after the install) I get the error:
ReplyDeleteImportError: libatlas.so.3gf: cannot open shared object file: No such file or directory
Any ideas?
Thanks a lot... It perfectly working
ReplyDelete