Upgrade to numpy 1.8.0 on Ubuntu 12.04
Solution 1
sudo pip install numpy --upgrade
will do the same thing with slightly less effort.
Solution 2
Ok, so I tried:
pip uninstall numpy
which returned:
Successfully uninstalled numpy
So then I did:
pip install numpy
but it said:
Requirement already satisfied (use --upgrade to upgrade): numpy in /home/gabriel/.local/lib/python2.7/site-packages
Cleaning up...
so apparently it was still there. I removed the contents of that folder and then I simply did:
sudo pip install numpy
This worked like freaking magic. Now I have NumPy 1.8.0, SciPy 0.12.0, Matplotlib 1.2.1
installed and everything is running like it should.
Gabriel
Updated on March 02, 2020Comments
-
Gabriel about 4 years
I'm running Ubuntu 12.04 which comes by default with
NumPy 1.6.0
(I have, actually had,Python 2.7.3
installed). As a result of the answer to this question polyfit() got an unexpected keyword argument 'w', I need to upgrade it.I downloaded the
.tar.gz
package for the version1.8.0
from here, unpacked it, moved inside the folder and run the commands:python setup.py build --fcompiler=gnu95 python setup.py install --user
as described in the user guide and in this question: Building NumPy 1.7.1 on Ubuntu.
This resulted in
NumPy
no longer loading inSpyder
, which now shows the error:Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/spyderlib/scientific_startup.py", line 16, in <module> from pylab import * #analysis:ignore File "/usr/local/lib/python2.7/dist-packages/pylab.py", line 1, in <module> from matplotlib.pylab import * File "/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py", line 165, in <module> from matplotlib.rcsetup import (defaultParams, File "/usr/local/lib/python2.7/dist-packages/matplotlib/rcsetup.py", line 20, in <module> from matplotlib.colors import is_color_like File "/usr/local/lib/python2.7/dist-packages/matplotlib/colors.py", line 52, in <module> import numpy as np File "/home/gabriel/.local/lib/python2.7/site-packages/numpy/__init__.py", line 153, in <module> from . import add_newdocs File "/home/gabriel/.local/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module> from numpy.lib import add_newdoc File "/home/gabriel/.local/lib/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module> from .type_check import * File "/home/gabriel/.local/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module> import numpy.core.numeric as _nx File "/home/gabriel/.local/lib/python2.7/site-packages/numpy/core/__init__.py", line 6, in <module> from . import multiarray ImportError: /home/gabriel/.local/lib/python2.7/site-packages/numpy/core/multiarray.so: undefined symbol: PyUnicodeUCS2_FromUnicode
upon loading it. The same happened when I tried with version
1.7.1
.I tried removing
numpy
with:sudo apt-get remove python-numpy
which also removed
matplotlib
andscipy
. So then I tried reinstalling them with:sudo apt-get install python-numpy python-scipy python-matplotlib
but this fails with the error:
from sre_constants import * File "/usr/local/lib/python2.7/sre_constants.py", line 18, in <module> from _sre import MAXREPEAT ImportError: cannot import name MAXREPEAT
Now I'm left with no running python and I don't even know how to go back to the previous stable version. So the question: can I install at least version
1.7.1
in my system and if not, how do I go back to a working1.6.0
version? Thanks.