Page 1 of 1

Broke something after a Python update. Tearing hair out trying to fix.

Posted: Fri Apr 21, 2023 11:43 am
by BaconButty
Quick version:
I have ES running with YoloV3 for years with no issues. I moved home and broke something, the error was related to one of the scripts pulling an IP from my old address. It wasn't anywhere in the configs, so I assumed a bug and since I could use an update, updated everything anyway.
Worked OK, some faults, decided to update some more. Now I have an error in one of the scripts.

Assumed this was a Python error, and while attempting to reinstall Python, completely killed ubuntu. Had to rebuild most of the system and I'm back at the same error again in "zm_detect.py".

Code: Select all

  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 15, in <module>
    import imutils
  File "/usr/local/lib/python3.8/dist-packages/imutils/__init__.py", line 8, in <module>
    from .convenience import translate
  File "/usr/local/lib/python3.8/dist-packages/imutils/convenience.py", line 6, in <module>
    import cv2
  File "/usr/local/lib/python3.8/dist-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/usr/local/lib/python3.8/dist-packages/cv2/__init__.py", line 175, in bootstrap
    if __load_extra_py_code_for_module("cv2", submodule, DEBUG):
  File "/usr/local/lib/python3.8/dist-packages/cv2/__init__.py", line 28, in __load_extra_py_code_for_module
    py_module = importlib.import_module(module_name)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/local/lib/python3.8/dist-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)
I know this shows CV2 here, however I can change to any other model and get this exact same error.

What am I missing?

Thanks

Re: Broke something after a Python update. Tearing hair out trying to fix.

Posted: Fri Apr 21, 2023 1:07 pm
by Magic919
Might be your OpenCV version according to Google.

Re: Broke something after a Python update. Tearing hair out trying to fix.

Posted: Fri Apr 21, 2023 1:18 pm
by BaconButty
I've seen that myself and tried multiple version with no success. This current install should be using the install.sh version.

Re: Broke something after a Python update. Tearing hair out trying to fix.

Posted: Fri Apr 21, 2023 1:29 pm
by Magic919
I don't know what you mean by that. I donwloaded it and compiled from source as recommended.

Re: Broke something after a Python update. Tearing hair out trying to fix.

Posted: Fri Apr 21, 2023 5:48 pm
by BaconButty
Just to be double sure that couldn't be part of it. I went and built from source using: "https://docs.opencv.org/4.x/d7/d9f/tuto ... stall.html"

Still the same.

Re: Broke something after a Python update. Tearing hair out trying to fix.

Posted: Fri Apr 21, 2023 6:13 pm
by Magic919
Which version are you running?

Re: Broke something after a Python update. Tearing hair out trying to fix.

Posted: Fri Apr 21, 2023 8:28 pm
by BaconButty

Code: Select all

isabell@isabell-MS-7C52:~$ python3
Python 3.8.10 (default, Mar 13 2023, 10:26:41)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'4.7.0'
>>>
Anything look wrong?

Re: Broke something after a Python update. Tearing hair out trying to fix.

Posted: Sat Apr 22, 2023 6:13 am
by Magic919
That is functionally ok. I’m on 4.6 and probably a lower Python version too. The OpenCV version is the thing that came up when I Google the error. Might be worth asking on the Slack channel as some of them are using and one is developing the new ZMES.

Re: Broke something after a Python update. Tearing hair out trying to fix.

Posted: Sat Apr 22, 2023 10:07 am
by BaconButty
Can you give me a link or something?

Re: Broke something after a Python update. Tearing hair out trying to fix.

Posted: Sat Apr 22, 2023 11:11 am
by Magic919