When you already have an older version of NumPy, use this:
pip install numpy --upgrade
If it still doesn't work, try:
pip install numpy --upgrade --ignore-installed
Answer from Rebecca on Stack OverflowWhen you already have an older version of NumPy, use this:
pip install numpy --upgrade
If it still doesn't work, try:
pip install numpy --upgrade --ignore-installed
Answer from Rebecca on Stack OverflowWhen you already have an older version of NumPy, use this:
pip install numpy --upgrade
If it still doesn't work, try:
pip install numpy --upgrade --ignore-installed
Because we have two NumPy installations in the system. One is installed by Homebrew and the second is installed by pip. So in order to solve the problem, we need to delete one and use the default NumPy install by OpenCV.
Check the path,
import numpy
print numpy.__path__
and manually delete it using rm.
pi 3b+ - Upgrading to Latest Numpy Version on Raspberry Pi 3 - Raspberry Pi Stack Exchange
How can I upgrade Numpy in just one version of Python? - Stack Overflow
Updating to NumPy 1.16.0? Make sure you uninstall previous versions first and upgrade pip
python - Can't install numpy after a pip upgrade - Stack Overflow
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
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.
» pip install numpy
Forgive me as I am on a mac, but I think a similar command should work on windows:
<path/to/particular/version/of/python> -m pip install numpy==<version number>
As an example from my machine:
$ # numpy versions before changes
$ python3.6 -m pip list | grep numpy
numpy 1.14.5
$ python3.7 -m pip list | grep numpy
numpy 1.15.2
$ # updating numpy for python3.6
$ python3.6 -m pip install numpy==1.16.1
.
.
.
$ # numpy versions after changes
$ python3.6 -m pip list | grep numpy
numpy 1.16.1
$ python3.7 -m pip list | grep numpy
numpy 1.15.2
I assume you are running pip install --upgrade numpy
Try where pip and where python to get an idea of which version of python your are executing pip from. Use which pip instead on Mac or Linux.
I assume it will return c:\python27\Scripts\pip.exe if so then try...
c:\python27\Scripts\pip.exe install --upgrade numpy
At NumPy we have been getting reports of failures after upgrading to the recently released 1.16.0 version. One common thread is they see an AttributeError: type object 'numpy.ndarray' has no attribute '__array_function__' on import. This is caused by having old versions of numpy mixed in with the new.
TL;DR: you should run pip uninstall numpy multiple times until it cleans up all the old versions before installing 1.16 and above, and you should also upgrade pip to the latest version if you can since it does a better job cleaning-before-installing. For more info read this issue and this PR to detect the situation and give a better error message. We have not yet figured out a way to fix the problem, other than giving a clearer error message.
If you are seeing this in your CI, two things: Thanks for testing and reporting issues, it helps us iron out the bugs as we try to improve NumPy. And secondly you too should upgrade pip, and uninstall old versions of numpy before installing the new.
Keep those issue reports coming on our tracker), we don't know it's broken if you don't tell us.