How to Fix AttributeError: partially initialized module ‘cv2’ has no attribute ‘gapi_wip_gst_GStreamerPipeline’

Diagram of How to Fix AttributeError: partially initialized module 'cv2' has no attribute 'gapi_wip_gst_GStreamerPipeline'

Diagram

AttributeError: partially initialized module ‘cv2’ has no attribute ‘gapi_wip_gst_GStreamerPipeline’ error occurs when “you have installed opencv-python 4.6.0.66 version, which has internal problems.”

How to fix it?

To fix the AttributeError: partially initialized module ‘cv2’ has no attribute ‘gapi_wip_gst_GStreamerPipeline’, “upgrade it to the latest version” or install the “4.5.5.64” specific version.

You can use the below command to upgrade opencv-python to the latest version.

pip install --upgrade opencv-python

And it should fix the error.

By chance, if you still get the error, then execute the following commands one by one.

pip uninstall opencv-python
pip uninstall opencv-contrib-python
pip uninstall opencv-contrib-python-headless

And then install the following package.

pip3 install opencv-contrib-python==4.5.5.62

You can check the installed current version of the opencv-python package and the type of cv2.gapi_wip_gst_GStreamerPipeline.

import cv2
print(cv2.__version__)

cv2.gapi.wip.GStreamerPipeline = cv2.gapi_wip_gst_GStreamerPipeline
print(type(cv2.gapi_wip_gst_GStreamerPipeline))

Output

4.8.0

<class 'type'>

As you can see that we have upgraded the package, printed the current version, and fixed the error.

Related posts

AttributeError: ‘module’ object has no attribute ‘drawMatches’

SystemError: initialization of _internal failed without raising an exception

ModuleNotFoundError: no module named ‘cv2’

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.