22

On my Ubuntu 14.04LTS, for python3, I have

 >>> import numpy
 >>> import scipy
 >>> numpy.__version__
 '1.8.2'
 >>> scipy.__version__
 '0.13.3'

I want to update numpy and scipy to the most recent version 1.9.2 and 0.16.0, I tried with the following commands

sudo pip3 install --upgrade numpy
sudo pip3 install --upgrade scipy

both commands ran successfully, but the version numbers didn't change to 1.9.2 and 0.16.0 at all for both python packages (after restarting the computer). Anyone knows how to update to the most version? Thank you very much!!

Allanqunzi
  • 321
  • 1
  • 2
  • 5
  • Same issue here. I have 64-bit ubuntu 14.04, python versions 2.7.6 and 3.4.3, and scipy 0.13.3 and numpy 1.8.2 (in both versions of python) – Adrian Feb 11 '16 at 08:14
  • Do you have `python3-numpy` and `python3-scipy` installed at the same time? – David Foerster Feb 11 '16 at 11:14
  • @DavidFoerster yes, I do, they're both listed in dpkg --get-selections. Is that bad? – Adrian Feb 11 '16 at 12:06
  • 1
    It's not "bad", but they may take precedence over the packages of the same name installed by `pip3`. Try to uninstall the Deb packages and see if that helps. – David Foerster Feb 11 '16 at 16:18
  • @DavidFoerster I ended up upgrading using easy_install (which is how I installed the packages in the first place, if I remember correctly), and that worked -- see my answer below. – Adrian Feb 12 '16 at 12:42
  • 3
    How did you install `numpy`? – edwinksl Nov 07 '16 at 04:11

3 Answers3

6

I found @David Foerster's comment quite helpful. I also had python3-numpy and python3-scipy installed, which was overriding my later install, so I simply issued:

sudo apt-get remove python3-numpy

And then all the proper versions were already there, as revealed by

pip3 show numpy
nograpes
  • 163
  • 1
  • 6
3

I had the same problem: sudo pip install --upgrade <package> ran correctly but the packages didn't actually get upgraded.

I just tried

sudo easy_install --upgrade numpy
sudo easy_install --upgrade scipy
sudo easy_install-3.4 --upgrade numpy
sudo easy_install-3.4 --upgrade scipy

and it worked: I now have numpy 1.11.0b3 and scipy 0.17.0 in both python and python3.

Adrian
  • 373
  • 4
  • 12
0

numpy can be updated with the pip Python package installer. pip can be hit or miss when trying to install some Python packages, because it's another package management tool which is installed alongside the Software Center, but pip does a good job of installing numpy.

Open the terminal and type:

sudo apt-get purge python-numpy
sudo apt install python-pip
pip install --user numpy

Another way of installing the latest version of numpy is inside a Python virtual environment. That way you can have your old version of numpy installed alongside the latest version of numpy and use both of them. Installing numpy locally inside a Python virtual environment does not require using sudo in the command:

pip install numpy
karel
  • 110,292
  • 102
  • 269
  • 299