Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when running Gesture_Controller.py #17

Open
yizhz opened this issue Jun 17, 2022 · 15 comments
Open

error when running Gesture_Controller.py #17

yizhz opened this issue Jun 17, 2022 · 15 comments

Comments

@yizhz
Copy link

yizhz commented Jun 17, 2022

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

@ankit-4129
Copy link
Collaborator

Please provide more information,

  1. Python version
  2. Complete error log

@yizhz
Copy link
Author

yizhz commented Jun 17, 2022

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)

@ankit-4129
Copy link
Collaborator

try this

pip install "opencv-python-headless<4.3"

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

@yizhz
Copy link
Author

yizhz commented Jun 17, 2022

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

@padminipriya69
Copy link

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

@ansariyusra
Copy link

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

@padminipriya69
Copy link

padminipriya69 commented Nov 25, 2022 via email

@tommeuh
Copy link

tommeuh commented Jan 6, 2023

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)

@padminipriya69
Copy link

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.

@musavveer
Copy link

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
Copy link

@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
Copy link

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

@prashant963951
Copy link

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

@joshuacodes07
Copy link

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)

@Rashid941
Copy link

(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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants