Pandas incompatible with numpy

Viewed 5660

I am using anaconda 3. When I try to import pandas I receive the following message:

ImportError: this version of pandas is incompatible with numpy < 1.15.4 your numpy version is 1.15.3. Please upgrade numpy to >= 1.15.4 to use this pandas version

Printing numpy.__path__ gives me the following

['C:\Users\andrei\AppData\Roaming\Python\Python37\site-packages\numpy']

In conda list, my numpy version is 1.19.1. I checked the above directory to find that it has only numpy 1.15.3 inside and nothing else. Spyder is using this path instead of the anaconda's path to numpy for some arcane reason.

3 Answers

Looks like you have somehow installed several versions of NumPy. Try to remove them all by running several times conda remove numpy and pip uninstall numpy. If you have two versions, the corresponding uninstall command needs to be run twice. After these, install a fresh version of NumPy conda install numpy

You can verify if you still have a version of NumPy installed

conda list | grep numpy
pip list | grep numpy

Note that these commands show only one version number even if you have several copies installed.

You can use conda to upgrade to upgrade your numpy. Run this command in the terminal:

conda update numpy

You need to remove this directory

C:\Users\andrei\AppData\Roaming\Python\

to fix this problem. It seems at some point you used pip to install numpy and that's interfering with the packages installed by conda (which is reporting the right version, as you said).

Furthermore, please be aware that pip and conda packages are binary incompatible, so you should avoid as much as possible to mix them.

Related