Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: numpy.core.multiarray failed to import

People also ask

How do I fix numpy core Multiarray failed to import?

The problem is that you might have created a file called numpy.py. This file might coincide with numpy library. So, delete that numpy.py file and the problem gets solved.

How do I know if numpy is installed?

Go to Python -> site-packages folder. There you should be able to find numpy and the numpy distribution info folder. If any of the above is true then you installed numpy successfully.

How do I know what version of numpy I have in Python?

1. With numpy. You can check your numpy version by opening an interactive Python session, importing numpy and use numpy. __version__ to check the version, as shown below.

What is the latest version of numpy?

NumPy 1.21. 0 (release notes) – 22 Jun 2021. NumPy 1.20. 3 (release notes) – 10 May 2021.


I was getting the same error and was able to solve it by updating my numpy installation to 1.8.0:

pip install -U numpy

In the case that

pip install -U numpy 

doesn't work (even with sudo), you may want to make sure you're using the right version of numpy. I had the same "numpy.core.multiarray failed to import" issue, but it was because I had 1.6 installed for the version of Python I was using, even though I kept installing 1.8 and assumed it was installing in the right directory.

I found the bad numpy version by using the following command in my Mac terminal:

python -c "import numpy;print(numpy.__version__);print(numpy.__file__)";

This command gave me the version and location of numpy that I was using (turned out it was 1.6.2). I went to this location and manually replaced it with the numpy folder for 1.8, which resolved my "numpy.core.multiarray failed to import" issue. Hopefully someone finds this useful!

Note: For the command, use double underscore before and after 'version' and 'file'


If you want a specific version:

pip install numpy==1.8

If you are using python3, the following command fixes the problem in macos.

python3 -m pip install numpy -I


Try sudo pip install numpy --upgrade --ignore-installed.

It work in Mac OS 10.11.

You should close The 'Rootless' if above shell isn't work.


pip install opencv-python==3.4.2.17 numpy==1.14.5

done the job for me!