. Advertisement .
. Advertisement .
The error: “ImportError: cannot import name ‘_registerMatType’ from ‘cv2.cv2’” is a common error that can show up in many ways. In this blog, we will go through some of the ways you can fix this issue. Read on.
When dose this error happen?
There are some steps that you found this error, like you try to utilize the Object Detection API, or when you use Colab. A possible cause may be that the opencv-python(184.108.40.206) version does not fit with opencv-python-headless(220.127.116.11). Moreover, the latest version 4.5.5 may get the wrong thing. Thus, you found the following problem.
ImportError: cannot import name '_registerMatType' from 'cv2.cv2'
How To Solve The Error: “ImportError: cannot import name ‘_registerMatType’ from ‘cv2.cv2’”?
To solve this problem there are many ways but we will provide the best solutions to correct it effectively and hope it help if you face with the issue: ImportError: cannot import name ‘_registerMatType’ from ‘cv2.cv2
Approach 1: Downgrade opencv-python-headless
This error happens since opencv-python(18.104.22.168) does not match opencv-python-headless latest version.
So, to begin with, utilize the following command to uninstall opencv-python-headless:
pip uninstall opencv-python-headless
Install opencv-python-headless==22.214.171.124 with this command:
pip install opencv-python-headless==126.96.36.199
Approach 2: Using docker
For the problem on docker, you should use version
188.8.131.52 . Then, install the package with
conda install -c conda-forge opencv=4.3.0
Now, you have solved your problem.
We hope you enjoyed our article about the error. With this knowledge, we know that you can fix your error: “ImportError: cannot import name ‘_registerMatType’ from ‘cv2.cv2’” quickly by following these steps! If you still have any other questions about fixing this syntax error, please leave a comment below. Thank you for reading!
Leave a comment