[Solved] ImportError: cannot import name ‘_registerMatType’ from ‘cv2.cv2’

Downgrade version work is fine not get anything error. but when we are using latest version opencv-python-headless==4.5.5.62, then we will face ImportError: cannot import name ‘_registerMatType’ from ‘cv2.cv2’, this error.

In this article, we will discuss about this ImportError: cannot import name ‘_registerMatType’ from ‘cv2.cv2’ error in Python. And how to resolve the error all the possible solutions with examples.

How ImportError: cannot import name ‘_registerMatType’ from ‘cv2.cv2’ Error Occurs?

This is a common error in Python. I am just running model_main_tf2.py on Object Detection API then I am getting error looks like the below:

ImportError: cannot import name '_registerMatType' from 'cv2.cv2'

So here are all the possible solutions that I tried to fix this error.

How To Fix ImportError: cannot import name ‘_registerMatType’ from ‘cv2.cv2’ Error?

  • How To Fix ImportError: cannot import name ‘_registerMatType’ from ‘cv2.cv2’ Error?

To Solve ImportError: cannot import name ‘_registerMatType’ from ‘cv2.cv2’ Error First you have to Downgrade opencv-python(4.5.2.52) because opencv-python-headless(4.5.5.62) does not match the latest version. So first uninstall headless by this command: pip uninstall opencv-python-headless==4.5.5.62 and now, install opencv-python-headless==4.5.2.52 with this command: pip install opencv-python-headless==4.5.2.52 Now, your will be solved.

  • ImportError: cannot import name ‘_registerMatType’ from ‘cv2.cv2’

To Solve ImportError: cannot import name ‘_registerMatType’ from ‘cv2.cv2’ Error First you have to Downgrade opencv-python(4.5.2.52) because opencv-python-headless(4.5.5.62) does not match the latest version. So first uninstall headless by this command: pip uninstall opencv-python-headless and now, install opencv-python-headless==4.5.2.52 with this command: pip install opencv-python-headless==4.5.2.52 Now, your will be solved.

Solution 1: Downgrade opencv-python-headless

So first of all Just uninstall opencv-python-headless with this command.

pip uninstall opencv-python-headless==4.5.5.62

and now, install opencv-python-headless==4.5.2.52 with this command.

pip install opencv-python-headless==4.5.2.52

Now, Your error must be solved.

Conclusion

In this article, we have discussed what causes the error and we have discussed ways to fix the error.

we hope this article has been informative. Thank you for reading. Kindly comment and let us know if you found it helpful.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Categories