I am tired to try to install numpy and scipy for phyton 2.7.5, I need this version of python because my final goal it's to install class (http://class-code.net/) and montepython (http://montepython.net/).
(I have ubuntu 12.04)
When I tried to import numpy or scipy I get the following error everytime:
$ phyton2.7
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/numpy/__init__.py", line 137, in <module>
import add_newdocs
File "/usr/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 9, in <module>
from numpy.lib import add_newdoc
File "/usr/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 4, in <module>
from type_check import *
File "/usr/lib/python2.7/dist-packages/numpy/lib/type_check.py", line 8, in <module>
import numpy.core.numeric as _nx
File "/usr/lib/python2.7/dist-packages/numpy/core/__init__.py", line 5, in <module>
import multiarray
ImportError: /usr/lib/python2.7/dist-packages/numpy/core/multiarray.so: undefined symbol: PyUnicodeUCS4_AsUnicodeEscapeString
>> import scipy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/scipy/__init__.py", line 78, in <module>
from numpy import show_config as show_numpy_config
File "/usr/lib/python2.7/dist-packages/numpy/__init__.py", line 137, in <module>
import add_newdocs
File "/usr/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 9, in <module>
from numpy.lib import add_newdoc
File "/usr/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 4, in <module>
from type_check import *
File "/usr/lib/python2.7/dist-packages/numpy/lib/type_check.py", line 8, in <module>
import numpy.core.numeric as _nx
File "/usr/lib/python2.7/dist-packages/numpy/core/__init__.py", line 5, in <module>
import multiarray
ImportError: /usr/lib/python2.7/dist-packages/numpy/core/multiarray.so: undefined symbol: PyUnicodeUCS4_AsUnicodeEscapeString
In order to get rid of the error I had tried:
- Satisfy python requirement:
$ sudo apt-get install build-essential python-dev gfortran
- Install with apt-get:
$ sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose
- Install requirement with pip:
$ sudo pip install requests
- ... and tried to installing with pip:
$ sudo pip install numpy
and$ sudo pip install scipy
- I already have the environment var:
export PYTHONPATH=/usr/lib/python2.7/dist-packages:${PYTHONPATH}
The last time I installed numpy and scipy (in older ubuntu version 10.x) this worked for me. sudo sh -c "wget http://python-distribute.org/distribute_setup.py -O- | python"
sudo sh -c "wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py -O- | python"
and then install both of them with pip as in (4)But now it seems that the server of python-distribute.org is down. I got the following error:
http://python-distribute.org/distribute_setup.py Resolving python-distribute.org (python-distribute.org)... failed: Name or service not known. wget: unable to resolve host address `python-distribute.org'
I had also tried to install numpy and scipy from synaptic and Ubuntu software center
I had failed in each of this attempts and now I don't know what to do. Am I missing something? How can I get numpy and scipy correctly installed for python? Any idea will be appreciated.
when I do
echo $PYTHONPATH
I get
/usr/lib/python2.7/dist-packages
echo $PYTHONPATH
to your question. Thank you :-)$PYTHONPATH
I already delete my definitions in.bashrc
, but I still have a definition somewhere else because I still have the env var$PYTHONPATH
for which I get:bash: /usr/lib/python2.7/dist-packages:: No such file or directory
(double colon)....bashrc
fileexport PYTHONPATH=/usr/lib/python2.7/dist-packages
... I do what the UCS4 build/UCS2 build as @Rmano sugest but I still get the same problem in both cases... :\