32
votes

I am trying to run jupyter notebook and getting following error. I am using Win 7 with anaconda python 3.7.

ImportError: Something is wrong with the numpy installation. While importing we detected an older version of numpy in ['c:\users\paperspace\anaconda3\envs\tensorflow10\lib\site-packages\numpy']. One method of fixing this is to repeatedly uninstall numpy until none is found, then reinstall this version.

I have followed the steps mentioned in the error but still not working.

10
Have you tried removing the complete environment tensorflow10 and creating it again? Are you using the command line or something else to access conda?p13rr0m
As @pierrom mentioned, removing the Anaconda env and then creating it again was a work around for me which worked.Shubham Panchal
@pierrom I did not try removing env. I will create a new environment and tensorflow11 and try again. I am using the command line to access anaconda.Nishant
I did try creating a new environment but still getting the same error. :(Nishant
Can you maybe edit your question and show how you set up the environment and how you install the packages. I'm no windows user so I don't no what is happening here, but maybe I can give you some advice that could still help you.p13rr0m

10 Answers

22
votes

Run

pip3 uninstall numpy

until you receive a message stating no files available with numpy to uninstall and then you can freshly install numpy using

pip install numpy

and that will fix the issue.

17
votes

Remove the folder numpy and reinstall numpy. work for me. Code below

rm -rf ~/.local/lib/python3.6/site-packages/numpy
pip install numpy
10
votes

I was getting the error when I was trying to use Keras. This can be fixed by removing the numpy package continuously by running pip3 uninstall numpy. And checking the successful un-installation by opening a python terminal and importing numpy package.

3
votes

This Means a Duplicated. Try pip uninstall numpy or pip3 uninstall numpy then sudo apt-get install python3-numpy

FOR (DEBIAN DIST)

2
votes

Use conda update --all

This works.

1
votes

per https://github.com/numpy/numpy/issues/12976, tried conda update -c defaults numpy and it worked. YMMV...

1
votes

Besides all the other answers, you may try something like

yum erase numpy

if you intalled some python library using yum install or apt-get install

1
votes

From what I understand, you have possibly used multiple package download managers, possibly to install something other than numpy but that has a dependency on numpy. Since you are using anaconda environment, it is a good practice to try to not to use other package managers such as pip in the same environment. When that happens, the problem is that pip adds the lib file as the path for the library and so, the system points to that numpy installation.(or in our case, does not know which one to choose)

So, use the equivalent of :

pip show <name of the package, i.e numpy> 
conda list <name of the package, i.e numpy> 

etc. Use the above to check which versions of these libraries you have on your system. Then, use the equivalent commands to remove all these versions. Be careful about the dependencies!

pip uninstall <name of the package, i.e numpy> 
conda uninstall <name of the package, i.e numpy> 

etc.

Next, use the anaconda environment to download the version of numpy that you require. The dependencies are probably going to get jumbled up.

In the future, try to create a new anaconda environment if you see dependency version conflicts instead of using some other package managers to download.

Cheers! I hope that helps.

0
votes

Apparently, multiple versions of numpy is installed on the computer in the same python virtual environment. This is strange and never happened with any other packages. Uninstall all the packages and install numpy again. This should solve the problem.

Use pip to uninstall.

pip3 uninstall numpy 
# or
python3 -m pip uninstall numpy

Then install again. Preferably with the exact version number.

pip3 install numpy==1.18.4

I had to uninstall numpy thrice. Until I got the message WARNING: Skipping numpy as it is not installed.

-2
votes

For me it was about the consoles used.

My cygwin terminal - NOPE, dos - NOPE, but console opened from Anaconda or Spyder etc... all commands (pip install etc) worked.