asweigart / pyautogui

A cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.
BSD 3-Clause "New" or "Revised" License
10.22k stars 1.24k forks source link

AttributeError: partially initialized module 'cv2' has no attribute 'gapi_wip_gst_GStreamerPipeline' (most likely due to a circular import) #706

Open BlueSchnabeltier opened 2 years ago

BlueSchnabeltier commented 2 years ago

So the code i wrote: import pyautogui, time

while True: try: pyautogui.write('owo hunt') pyautogui.press('enter') time.sleep(1) pyautogui.write('owo sell all') pyautogui.press('enter') time.sleep(14) except: break

And i gives me this: Traceback (most recent call last): File "C:\Users\User\Desktop\Hunt_Script_v1.3\lol.py", line 1, in import pyautogui, time File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\pyautogui__init.py", line 183, in import pyscreeze File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\pyscreeze__init.py", line 45, in import cv2, numpy File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\cv2\init.py", line 181, in bootstrap() File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\cv2\init.py", line 175, in bootstrap if load_extra_py_code_for_module("cv2", submodule, DEBUG): File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\cv2\init.py", line 28, in load_extra_py_code_for_module py_module = importlib.import_module(module_name) File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\importlib__init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\cv2\gapi\init__.py", line 290, in cv.gapi.wip.GStreamerPipeline = cv.gapi_wip_gst_GStreamerPipeline AttributeError: partially initialized module 'cv2' has no attribute 'gapi_wip_gst_GStreamerPipeline' (most likely due to a circular import) [Finished in 0.586s]

Sakshat234 commented 2 years ago

Hi were you able to solve the issue.Its very annoying!

MRK4863 commented 2 years ago

Same here. Please update if you get any solution

BlueSchnabeltier commented 2 years ago

Same here.

Please update if you get any solution

Actually i reinstalled my whole Python installation and that worked for me, but i had to install every Package new

FabricioSausen commented 2 years ago

I fixed it by simply upgrading my opencv-python from 4.5.?.? (not sure which version it was anymore) to the currently latest one, which is 4.6.0.66.

Summary: run pip install -U opencv-python.

tsmiyamoto commented 2 years ago

In my case, downgrading opencv-python to 4.5.5.64 solved the problem.

pip install opencv-python==4.5.5.64
harrytrinh96 commented 2 years ago

Thank you guys!!

JayRizzo commented 2 years ago

FWIW, I just did a fresh install and had no issues on 3.10.5.

I had this issue after upgrading my OS as well. I wrote more here about what steps I had done: https://github.com/asweigart/pyautogui/issues/495#issuecomment-1172557674

MRK4863 commented 2 years ago

Thank you guys!!

jiluojiluo commented 1 year ago

In my case, downgrading opencv-python to 4.5.5.64 solved the problem.

pip install opencv-python==4.5.5.64

yes,it works

MikakuU commented 1 year ago

Thanks, it works for me, too.