1

I installed numpy with pip, version 1.15

pip show numpy
python -m pip show numpy

Name: numpy
Version: 1.15.0

However when I import numpy with python, I get version 1.7.1

>>> import numpy
>>> numpy.version.version
'1.7.1'

Where is this numpy coming from and how can I disable it?

I checked on all folders from the sys.path, and erased folders of numpy version 1.7.1

import sys sys.path ['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/home/hirsch/.local/lib/python2.7/site-packages', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0']

But that did not solve this issue.

>>> which pip
/home/hirsch/.local/bin/pip

>>> which python
/usr/bin/python
4
  • Can you execute which pip? Commented Feb 20, 2019 at 22:40
  • added output to the post Commented Feb 20, 2019 at 22:43
  • Thanks. Your pip points to some local (user) installation of Python, while what you show comes from system version of Python. Can you run which python? Commented Feb 20, 2019 at 22:46
  • @LukaszTracewski also included now Commented Feb 20, 2019 at 22:48

1 Answer 1

4

Use python -m pip instead of pip, you likely have multiple pythons installed.

python -m pip show numpy

Name: numpy
Version: 1.7.1

which pip will tell you the path of your unwanted install

An other possible cause is that you have two Numpy's installed on the same python, in which case uninstall both and reinstall.

The thing is, if you have multiple versions of numpy and import it, python imports the first one it finds. You might want to look int virtual environment if you need to keep multiple versions of numpy (in every case, you have to uninstall older numpy's that are in conflict).

Sign up to request clarification or add additional context in comments.

5 Comments

That is what I use, the output is 1.15.0
` >>> python -m pip uninstall numpy Uninstalling numpy-1.15.0: `
then it proceeds with Uninstalling numpy-1.14.5 ... should I just keep removing all numpys? Why can't i just change the import path from where it is fetching the module?
it worked. I kept uninstalling until there was nothing left. Curiously no version was 1.7.1 so I can't explain that. Afterwards installed 1.15.0 it worked well. Can you edit your answer to explain that so I can accept it thanks!
So this is solved, but it seems you have another problem. You should check why pip and python don't point to the same python install. ~/.profile is often a good place to start to check if there is something "suspycious". I don't really see what you want me to add to the answer, it looks complete to me now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.