Gesture-Controlled-Virtual-Mouse icon indicating copy to clipboard operation
Gesture-Controlled-Virtual-Mouse copied to clipboard

error when running Gesture_Controller.py

Open yizhz opened this issue 2 years ago • 15 comments

I encounter the following error when running Gesture_Controller.py:

File "C:\Users\yiyun.zy\anaconda3\envs\py385\lib\importlib_init_.py", line 127, in import_module return _bootstrap.gcd_import(name[level:], package, level) File "C:\Users\yiyun.zy\Desktop\xuelangyun\gesture_control\venv\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)

How can I solve it? Thank you so much

yizhz avatar Jun 17 '22 07:06 yizhz

Please provide more information,

  1. Python version
  2. Complete error log

ankit-4129 avatar Jun 17 '22 08:06 ankit-4129

Please provide more information,

  1. Python version
  2. Complete error log
  1. 3.8.5
  2. Traceback (most recent call last): File "Gesture_Controller.py", line 3, in import cv2 File "C:\Users\yiyun.zy\Desktop\xuelangyun\gesture_control\venv\lib\site-packages\cv2_init_.py", line 181, in bootstrap() File "C:\Users\yiyun.zy\Desktop\xuelangyun\gesture_control\venv\lib\site-packages\cv2_init_.py", line 175, in bootstrap if _load_extra_py_code_for_module("cv2", submodule, DEBUG): File "C:\Users\yiyun.zy\Desktop\xuelangyun\gesture_control\venv\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\yiyun.zy\anaconda3\envs\py385\lib\importlib_init.py", line 127, in import_module return _bootstrap.gcd_import(name[level:], package, level) File "C:\Users\yiyun.zy\Desktop\xuelangyun\gesture_control\venv\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)

yizhz avatar Jun 17 '22 08:06 yizhz

try this

pip install "opencv-python-headless<4.3"

reference: https://stackoverflow.com/questions/72545779/cv2-not-work-after-install-mediapipe-library/72625417

ankit-4129 avatar Jun 17 '22 08:06 ankit-4129

try this

pip install "opencv-python-headless<4.3"

reference: https://stackoverflow.com/questions/72545779/cv2-not-work-after-install-mediapipe-library/72625417

I then get "ImportError: DLL load failed while importing win32api: No module named win32api"

I tried uninstall and install, tried pip install pywin32==227, tried python pywin32_postinstall.py -install. But none works

yizhz avatar Jun 17 '22 08:06 yizhz

I encounter the following error when running Gesture_Controller.py:

File "C:\Users\yiyun.zy\anaconda3\envs\py385\lib\importlib__init__.py", line 127, in import_module return bootstrap.gcd_import(name[level:], package, level) File "C:\Users\yiyun.zy\Desktop\xuelangyun\gesture_control\venv\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)

How can I solve it? Thank you so much

I am facing the exact same issue, can you please help me out

padminipriya69 avatar Oct 19 '22 10:10 padminipriya69

hey ! facing the same issue here , did you get any resolution to it??

ansariyusra avatar Nov 23 '22 16:11 ansariyusra

No, not yet, I am currently working on that project, maybe if I get any solution, I will let you know. If you find any solution, please let me know

On Wed, 23 Nov 2022, 22:28 Yusra Ansari, @.***> wrote:

hey ! facing the same issue here , did you get any resolution to it??

— Reply to this email directly, view it on GitHub https://github.com/xenon-19/Gesture-Controlled-Virtual-Mouse/issues/17#issuecomment-1325387334, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASTJE4J5IRGISC5LXO2GA6DWJZELPANCNFSM5ZBMKOBA . You are receiving this because you commented.Message ID: @.*** com>

padminipriya69 avatar Nov 25 '22 10:11 padminipriya69

Hello, same problem with the same configuration then tutorial installation : python Gesture_Controller.py

Traceback (most recent call last):
  File "Gesture_Controller.py", line 3, in <module>
    import cv2
  File "C:\Users\tomle\anaconda3\envs\gest\lib\site-packages\cv2\__init__.py", line 181, in <module>
    bootstrap()
  File "C:\Users\tomle\anaconda3\envs\gest\lib\site-packages\cv2\__init__.py", line 175, in bootstrap
    if __load_extra_py_code_for_module("cv2", submodule, DEBUG):
  File "C:\Users\tomle\anaconda3\envs\gest\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\tomle\anaconda3\envs\gest\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\tomle\anaconda3\envs\gest\lib\site-packages\cv2\gapi\__init__.py", line 301, in <module>
    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)

tommeuh avatar Jan 06 '23 18:01 tommeuh

I got the same error as you, I followed these steps and now I can run the project.

  1. For this error AttributeError: partially initialized module 'cv2' has no attribute 'gapi_wip_gst_GStreamerPipeline' (most likely due to a circular import) I did this
pip uninstall opencv-python
pip uninstall opencv-contrib-python
pip uninstall opencv-contrib-python-headless
and then
pip3 install opencv-contrib-python==4.5.5.62

reference: https://stackoverflow.com/questions/72706073/attributeerror-partially-initialized-module-cv2-has-no-attribute-gapi-wip-gs

  1. When I executed after making the above changes, I got the following error.

image that is solved by pip install protobuf==3.20.* reference: https://stackoverflow.com/questions/72441758/typeerror-descriptors-cannot-not-be-created-directly

Finally when I run this, I got the correct output python Gesture_Controller.py

I hope it Helps.

padminipriya69 avatar Jan 07 '23 08:01 padminipriya69

try this

pip install "opencv-python-headless<4.3"

reference: https://stackoverflow.com/questions/72545779/cv2-not-work-after-install-mediapipe-library/72625417

I then get "ImportError: DLL load failed while importing win32api: No module named win32api"

I tried uninstall and install, tried pip install pywin32==227, tried python pywin32_postinstall.py -install. But none works

Did you fix this issue? I guess you are working on mac os

musavveer avatar Mar 12 '23 03:03 musavveer

@xenon-19 @Viral-Doshi @ankit-4129 @parth-12 I am getting this error: Traceback (most recent call last): File "/Users/musavveer/spam/02_Grp_GestureAndVoiceControlledVirtualMouse/code/src/Gesture_Controller.py", line 3, in <module> import cv2 File "/Users/musavveer/opt/anaconda3/envs/gest/lib/python3.8/site-packages/cv2/__init__.py", line 181, in <module> bootstrap() File "/Users/musavveer/opt/anaconda3/envs/gest/lib/python3.8/site-packages/cv2/__init__.py", line 175, in bootstrap if __load_extra_py_code_for_module("cv2", submodule, DEBUG): File "/Users/musavveer/opt/anaconda3/envs/gest/lib/python3.8/site-packages/cv2/__init__.py", line 28, in __load_extra_py_code_for_module py_module = importlib.import_module(module_name) File "/Users/musavveer/opt/anaconda3/envs/gest/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "/Users/musavveer/opt/anaconda3/envs/gest/lib/python3.8/site-packages/cv2/mat_wrapper/__init__.py", line 33, in <module> cv._registerMatType(Mat) AttributeError: partially initialized module 'cv2' has no attribute '_registerMatType' (most likely due to a circular import)

musavveer avatar Mar 12 '23 04:03 musavveer

I got the same error as you, I followed these steps and now I can run the project.

  1. For this error AttributeError: partially initialized module 'cv2' has no attribute 'gapi_wip_gst_GStreamerPipeline' (most likely due to a circular import) I did this
pip uninstall opencv-python
pip uninstall opencv-contrib-python
pip uninstall opencv-contrib-python-headless
and then
pip3 install opencv-contrib-python==4.5.5.62

reference: https://stackoverflow.com/questions/72706073/attributeerror-partially-initialized-module-cv2-has-no-attribute-gapi-wip-gs

  1. When I executed after making the above changes, I got the following error.

image that is solved by pip install protobuf==3.20.* reference: https://stackoverflow.com/questions/72441758/typeerror-descriptors-cannot-not-be-created-directly

Finally when I run this, I got the correct output python Gesture_Controller.py

I hope it Helps.

HI can you help me fixing the issue

musavveer avatar Mar 12 '23 04:03 musavveer

I got the same error as you, I followed these steps and now I can run the project.

  1. For this error AttributeError: partially initialized module 'cv2' has no attribute 'gapi_wip_gst_GStreamerPipeline' (most likely due to a circular import) I did this
pip uninstall opencv-python
pip uninstall opencv-contrib-python
pip uninstall opencv-contrib-python-headless
and then
pip3 install opencv-contrib-python==4.5.5.62

reference: https://stackoverflow.com/questions/72706073/attributeerror-partially-initialized-module-cv2-has-no-attribute-gapi-wip-gs

  1. When I executed after making the above changes, I got the following error.

image that is solved by pip install protobuf==3.20.* reference: https://stackoverflow.com/questions/72441758/typeerror-descriptors-cannot-not-be-created-directly

Finally when I run this, I got the correct output python Gesture_Controller.py

I hope it Helps.

error is resolve but the not get the output

prashant963951 avatar Apr 09 '23 17:04 prashant963951

Hello, I exactly did what u said uninstalled pip and also installed protobuf==3.20.* pip but, the code is not showing output and it also not showing any errors. what should i do now. even commented and uncommented the last two lines. Can you help me with this as soon as possible. Screenshot (26)

joshuacodes07 avatar Apr 12 '23 22:04 joshuacodes07

(gest) C:\Users\Admin\OneDrive\Desktop\Gesture-COntrolled-Virtual-Mouse\src>python Gesture_Controller.py

(gest) C:\Users\Admin\OneDrive\Desktop\Gesture-COntrolled-Virtual-Mouse\src>

Rashid941 avatar Sep 12 '23 14:09 Rashid941