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.
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.
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.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With