Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using old version of numpy even with a newer version installed

Tags:

python

numpy

I have used easy_install to install numpy to install numpy 1.7.1, but when I check my version in python:

python -c "import numpy; print numpy.version.version"

It says 1.6.2

What am I doing wrong?

like image 786
jlonganecker Avatar asked May 06 '13 02:05

jlonganecker


People also ask

How do I uninstall a specific version of NumPy?

Use the pip Command to Uninstall NumPy The pip command can install and uninstall most Python libraries through the console.

Do I have to install NumPy every time?

Depends. Your first numpy module likely installed in a virtual environment. Therefore, unless you specify that same virtual environment for your new project, your new project will be unable to access a module installed in a virtual environment it doesn't use.


2 Answers

Most likely, you have installed numpy from a debian repository or a pip installation with other parameters. Use

python -c 'import os,numpy;print(numpy.__file__)'

to find out where the rogue numpy version lies. While you can just delete this directory, you can also ask your package manager what package the file belongs to. Again, on a debian system:

$ python -c 'import numpy;print(numpy.__file__)'
/usr/lib/pymodules/python2.7/numpy/__init__.pyc
$ readlink -f /usr/lib/pymodules/python2.7/numpy/__init__.py
/usr/share/pyshared/numpy/__init__.py
$ dpkg -S /usr/share/pyshared/numpy/__init__.py
python-numpy: /usr/share/pyshared/numpy/__init__.py
$ sudo apt-get remove python-numpy
like image 170
phihag Avatar answered Sep 27 '22 17:09

phihag


sudo easy_install -U numpy

...after many tries, the code above worked for me, finally!

like image 38
Jacob Irwin Avatar answered Sep 27 '22 17:09

Jacob Irwin