cv2 import Error:
(paddle) C:\Windows\system32>python
Python 3.8.12 (default, Oct 12 2021, 03:01:40) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import cv2
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
File “D:\anaconda3\envs\paddle\lib\site-packages\cv2\__init__.py”, line 8, in <module>
from .cv2 import *
ImportError: numpy.core.multiarray failed to import
>>> exit()
Solution:
pip install -U numpy
New problems,
(paddle) C:\Windows\system32>pip install -U numpy
Requirement already satisfied: numpy in d:\anaconda3\envs\paddle\lib\site-packages (1.19.3)
Collecting numpy
Downloading numpy-1.22.3-cp38-cp38-win_amd64.whl (14.7 MB)
|████████████████████████████████| 14.7 MB 547 kB/s
Installing collected packages: numpy
Attempting uninstall: numpy
Found existing installation: numpy 1.19.3
Uninstalling numpy-1.19.3:
Successfully uninstalled numpy-1.19.3
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
paddlepaddle-gpu 2.2.2 requires numpy<=1.19.3,>=1.13; python_version >= "3.5" and platform_system == "Windows", but you have numpy 1.22.3 which is incompatible.
openvino 2021.4.2 requires numpy<1.20,>=1.16.6, but you have numpy 1.22.3 which is incompatible.
openvino-dev 2021.4.2 requires numpy<1.20,>=1.16.6, but you have numpy 1.22.3 which is incompatible.
Successfully installed numpy-1.22.3
However, I tested it and found that this new error has not caused too many problems.
To meet compatibility, if you want to change back to the version, you can
pip install numpy==1.19.3
pip uninstall opencv-contrib-python
conda install opencv
Note that the following instructions will install (uninstall) the latest version of OpenCV,
pip (un)install opencv-contrib-python
Reference:
https://stackoverflow.com/questions/20518632/importerror-numpy-core-multiarray-failed-to-import
Read More:
- Raspberry pie import opencv error: ImportError: numpy.core.multiarray failed to import
- Python ImportError: numpy.core.multiarray failed to import
- [Solved] Original error was: No module named ‘numpy.core._multiarray_umath‘
- Keras import package error: importerror: cannot import name ‘get_ config‘
- [Solved] mnn Import Error: initMNN: init numpy failed
- [Solved] From pip._internal import cmdoptions ImportError: cannot import name SourceDistribution
- Import CV2 & Numpy report red Warning and Error [How to Solve]
- How to Solve M1 chip import numpy Error
- Import win32API; importerror: DLL load failed: the specified program was not found
- [Solved] Pyinstaller package opencv error: ImportError: OpenCV loader: missing configuration file: [‘config.py’]. Check OpenCV installation.
- import statsmodels.api as sm Error: ImportError: DLL load failed while importing _arpack: The specified program could not be found.
- VScode import numpy Error: DLL load failed [How to Solve]
- How to Solve Python ImportError: cannot import name UnrewindableBodyError
- How to Solve Error “ImportError: cannot import name imsave“
- [Solved] D2lzh_Pytorch Import error: importerror: DLL load failed while importing
- [Solved] Numpy Load Error: DLL load failed while importing _multiarray_umath: Could not be found Module
- ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.
- [Solved] Import cv2 Error: ImportError: libGL.so.1: cannot open shared object file: No such file or directory
- Tensorflow import Error: ImportError: libcuda.so.1: cannot open shared object file: No such file or dire
- [Solved] ImportError: cannot import name ‘delayed‘ from ‘sklearn.utils.fixes‘