numpy installation in ubuntu
![](https://secure.gravatar.com/avatar/d73e328b38db5e2f32e6738f417ea041.jpg?s=120&d=mm&r=g)
hi everyone, i'm very new to ubuntu, now trying to install numpy and wxpython. Having unpacked numpy and running the standard commnad in idle from numpy import * i get the message ImportError: Error importing numpy: you should not try to import numpy from its source directory; please exit the numpy source tree, and relaunch your python intepreter from there. I quit the folder with numpy, relaunched python, but the module wasn't even identified. thanks
![](https://secure.gravatar.com/avatar/e9c662922b80af544c5e57ea052cc35b.jpg?s=120&d=mm&r=g)
On Mon, Oct 18, 2010 at 11:55 AM, Alex Ter-Sarkissov <sigma.z.1980@gmail.com> wrote:
hi everyone, i'm very new to ubuntu, now trying to install numpy and wxpython.
Did you consider installing the Ubuntu provided packages, e.g. via apt-get or the Synaptic Package manager? That is *much* easier - but you won't get the very latest versions.
Having unpacked numpy and running the standard commnad in idle
Could you clarify what you did? You don't just unpack the archive and use it as it - there is C code that must be compiled etc. Peter
![](https://secure.gravatar.com/avatar/1a5257bd5010d244c746255a35e02c0d.jpg?s=120&d=mm&r=g)
To do a standard installation, run sudo python setup.py install from inside the numpy directory Then your import should work elsewhere. By the way, "import *" can cause difficulties when you're working with several different files. For example, if you have a function called 'save' somewhere that imports something that does 'from numpy import *' you'll have problems because there is a numpy.save. It's better to import numpy with a shorter name, ie, "import numpy as N" or "import numpy as npy" than to drop the namespace altogether. On Mon, Oct 18, 2010 at 6:55 AM, Alex Ter-Sarkissov <sigma.z.1980@gmail.com>wrote:
hi everyone, i'm very new to ubuntu, now trying to install numpy and wxpython.
Having unpacked numpy and running the standard commnad in idle
from numpy import *
i get the message
ImportError: Error importing numpy: you should not try to import numpy from its source directory; please exit the numpy source tree, and relaunch your python intepreter from there.
I quit the folder with numpy, relaunched python, but the module wasn't even identified.
thanks
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
![](https://secure.gravatar.com/avatar/0c95cd90aef753bc89f1c48370eeb8b7.jpg?s=120&d=mm&r=g)
On 10/18/2010 10:45 PM, Pauli Virtanen wrote:
Mon, 18 Oct 2010 09:07:42 -0400, Ian Goodfellow wrote:
To do a standard installation, run sudo python setup.py install from inside the numpy directory
Preferably,
sudo python setup.py install --prefix=/usr/local
and then you don't mess up your package manager.
Ubuntu actually does this by default (i.e. the default prefix expands to /usr/local on ubuntu and debian). But I think we should tell people to use the --user for python 2.6 and above by default: that's the safest method, does not require sudo and works on every platform, cheers, David
![](https://secure.gravatar.com/avatar/d73e328b38db5e2f32e6738f417ea041.jpg?s=120&d=mm&r=g)
thanks, this didn't seem to work. I get a whole range of errors, most importantly SystemError: Cannot compiler 'Python.h'. Perhaps you need to install python-dev|python-devel. Apparently, according to numpy installation guide (here<http://docs.scipy.org/doc/numpy/user/install.html#fortran-abi-mismatch>) i got the wrong compiler installed. How do I find out which 1 I got? 2010/10/19 David <david@silveregg.co.jp>
On 10/18/2010 10:45 PM, Pauli Virtanen wrote:
Mon, 18 Oct 2010 09:07:42 -0400, Ian Goodfellow wrote:
To do a standard installation, run sudo python setup.py install from inside the numpy directory
Preferably,
sudo python setup.py install --prefix=/usr/local
and then you don't mess up your package manager.
Ubuntu actually does this by default (i.e. the default prefix expands to /usr/local on ubuntu and debian).
But I think we should tell people to use the --user for python 2.6 and above by default: that's the safest method, does not require sudo and works on every platform,
cheers,
David _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
![](https://secure.gravatar.com/avatar/da3a0a1942fbdc5ee9a9b8115ac5dae7.jpg?s=120&d=mm&r=g)
Tue, 19 Oct 2010 21:26:38 +1300, Alex Ter-Sarkissov wrote:
thanks, this didn't seem to work. I get a whole range of errors, most importantly
SystemError: Cannot compiler 'Python.h'. Perhaps you need to install python-dev|python-devel.
I think you should do "sudo apt-get install python-dev"
![](https://secure.gravatar.com/avatar/d73e328b38db5e2f32e6738f417ea041.jpg?s=120&d=mm&r=g)
thanks! it actually worked! maybe u could recommend some good sources/readin on how to install different modules in python run under linux thanks again, alex 2010/10/19 Pauli Virtanen <pav@iki.fi>
Tue, 19 Oct 2010 21:26:38 +1300, Alex Ter-Sarkissov wrote:
thanks, this didn't seem to work. I get a whole range of errors, most importantly
SystemError: Cannot compiler 'Python.h'. Perhaps you need to install python-dev|python-devel.
I think you should do "sudo apt-get install python-dev"
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
participants (5)
-
Alex Ter-Sarkissov
-
David
-
Ian Goodfellow
-
Pauli Virtanen
-
Peter