ImportError: numpy.core.multiarray failed to import

Answered

Hye..I'm using pycharm edition 2020.2.5, opencv version 4.4.0.46 and numpy version 1.19.4. But I get this error while running my code

( File "C:\Users\Aspire\AppData\Local\Programs\Python\Python37\lib\site-packages\cv2\__init__.py", line 5, in <module>
from .cv2 import *
ImportError: numpy.core.multiarray failed to import) 

Can you help me please.

0
4 comments

There are some known issues with numpy==1.19.4

Could you install the 1.19.3 version and try again? pip install numpy==1.19.3

In any case, the problem is not related to PyCharm, but to the environment. Perhaps these opencv and numpy versions are incompatible.

2
Avatar
Permanently deleted user

I have reinstall numpy version 1.19.3 and it works. Thank You 

0

I am facing the same issue with numpy version 1.21.4 however it only occurs when I switch into a different directory apart from the one where I have installed python.

Based on your path, it works fine if I move my file and run it in "C:\Users\Aspire" however switching to any other folder or drive gives me the error: "( File "C:\Users\Aspire\AppData\Local\Programs\Python\Python37\lib\site-packages\cv2\__init__.py", line 5, in <module>
from .cv2 import *
ImportError: numpy.core.multiarray failed to import) "

0

Your Numpy library needs to be updated. This error is caused by a version of NUMPY that is outdated or incompatible. This link was helpful https://kodlogs.net/332/numpy-core-multiarray-failed-to-import-windows

0

Please sign in to leave a comment.