2

I have numpy 1.11 on my 15.10 Ubuntu machine and I need the same version on my 12.04 machine. I am not sure if this is possible at all and do not understand enough of linux to know.

I have tried

sudo pip install numpy --upgrade
sudo apt-get dist-upgrade

I tried reinstalling, etc. and nothing seems to work. Are the libraries simply not compatible or is there a way to do this?

I don't want to mess with the ubuntu version because this is a shared lab machine and I am worried that other people's experiments could have issues if I did.

EDIT: When I run the upgrade it says that it has installed successfully but doesn't say anything about the version.

here is the tail end of the output when I run the upgrade:

types -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/numpy/random/mtrand/mtrand.o build/temp.linux-x86_64-2.7/numpy/random/mtrand/randomkit.o build/temp.linux-x86_64-2.7/numpy/random/mtrand/initarray.o build/temp.linux-x86_64-2.7/numpy/random/mtrand/distributions.o -Lbuild/temp.linux-x86_64-2.7 -o build/lib.linux-x86_64-2.7/numpy/random/mtrand.so
Creating build/scripts.linux-x86_64-2.7/f2py
  adding 'build/scripts.linux-x86_64-2.7/f2py' to scripts
changing mode of build/scripts.linux-x86_64-2.7/f2py from 644 to 755

warning: no previously-included files matching '*.pyo' found anywhere in distribution
warning: no previously-included files matching '*.pyd' found anywhere in distribution
changing mode of /usr/local/bin/f2py to 755
Successfully installed numpy
Cleaning up...

When I check my version:

>>> import numpy
>>> numpy.version.version
'1.8.2'
badner
  • 768
  • 2
  • 10
  • 31

4 Answers4

3

What happens when you run

sudo pip install numpy --upgrade

?

When I run it, I get this:

Does it Collecting numpy
  Downloading numpy-1.11.1.zip (4.7MB)
    100% |████████████████████████████████| 4.7MB 108kB/s 
Installing collected packages: numpy
  Found existing installation: numpy 1.9.2
    Uninstalling numpy-1.9.2:
      Successfully uninstalled numpy-1.9.2
  Running setup.py install for numpy

If you are seeing this, my next question would be: are you sure your paths are set correctly?

Jesse
  • 81
  • 4
  • running "sudo pip install numpy --upgrade" it downloads a bunch of packages. In the end I get: Creating build/scripts.linux-x86_64-2.7/f2py adding 'build/scripts.linux-x86_64-2.7/f2py' to scripts changing mode of build/scripts.linux-x86_64-2.7/f2py from 644 to 755 warning: no previously-included files matching '*.pyo' found anywhere in distribution warning: no previously-included files matching '*.pyd' found anywhere in distribution changing mode of /usr/local/bin/f2py to 755 Successfully installed numpy Cleaning up... – badner Jul 08 '16 at 11:56
  • I posted the output better in my question. it is easier to read. I am not seeing what you are. – badner Jul 08 '16 at 12:55
2

I find it is more reliable and repeatable to manage your python environment using the Anaconda python distribution. Rather than using apt-get, you would use conda as your python package management system and it should work fairly consistently across platforms especially with major packages like numpy.

Vince W.
  • 3,561
  • 3
  • 31
  • 59
2

Ok I resolved my Issue. I will summarize the problem:

When I installed Scipy by installing the scipy pack it automatically resinstalls numpy 1.8 no materr what, even if it is just:

sudo apt-get install python-scipy

What worked for me:

sudo apt-get purge python-numpy
sudo pip install numpy
sudo pip install scipy
sudo pip install -U scikit-learn

I don't know why the apt-get packages are not updated, maybe this is an issue that exists. Thank you all for your helpful orientations. :-)

badner
  • 768
  • 2
  • 10
  • 31
1

This should work

pip install --upgrade numpy 

Could you post the error message you received?

The next time you are working on a project, you could use virtualenv. virtualenv will create an isolated environment for each of your projects with a copy of the python binary, the entire Python standard library, the pip installer as well as a copy of the site-packages directory. This way the environment would be local to you and would not affect the version of Python or its dependencies across all user accounts.

KartikKannapur
  • 973
  • 12
  • 19
  • Are you sure Python has been installed correctly? Could you also try installed numpy via `whl` You can use this link - http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy – KartikKannapur Jul 08 '16 at 13:21