dlandon / zoneminder.machine.learning

Zoneminder Docker
GNU General Public License v2.0
318 stars 143 forks source link

SQLAlchemy 1.4.0 Breaks zm_detect.py #174

Closed williamsrAndrew closed 3 years ago

williamsrAndrew commented 3 years ago

First, a note here is that I am still pulling the latest image from docker hub (dlandon/zoneminder) which looks to be deprecated, but I wanted to post this somewhere and I think this is the best place.

I'm not exactly sure if this is an issue with zmeventnotification/pyzm or with this docker install, but sqlalchemy was updated to version 1.4.0 on Monday 3/15 and it causes zm_detect.py/pyzm to break when running object detection.

root@zoneminder-574b887558-zfk2j:/# sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py --config /etc/zm/objectconfig.ini --eventid 305 --monitorid 2 --debug
Unrecoverable error:__init__() got an unexpected keyword argument 'reflect' Traceback:Traceback (most recent call last):
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 531, in <module>
    main_handler()
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 223, in main_handler
    log.init(name='zmesdetect_' + 'm' + args.get('monitorid'), override=g.config['pyzm_overrides'])
  File "/usr/local/lib/python3.8/dist-packages/pyzm/ZMLog.py", line 166, in init
    meta = MetaData(engine,reflect=True)
TypeError: __init__() got an unexpected keyword argument 'reflect'

In order to fix this, I just need to downgrade sqlalchemy to 1.3.23. I'm not sure where this is specified in the install docker install, but either pyzm will need to be updated to use 1.4.0 or this docker should be set to install the proper version of sqlalchemy.

root@zoneminder-574b887558-zfk2j:/# pip3 install sqlalchemy==1.3.23
Collecting sqlalchemy==1.3.23
  Using cached SQLAlchemy-1.3.23-cp38-cp38-manylinux2010_x86_64.whl (1.3 MB)
Installing collected packages: sqlalchemy
  Attempting uninstall: sqlalchemy
    Found existing installation: SQLAlchemy 1.4.0
    Uninstalling SQLAlchemy-1.4.0:
      Successfully uninstalled SQLAlchemy-1.4.0
Successfully installed sqlalchemy-1.3.23
Juggler00 commented 3 years ago

Thank you for finding that discrepancy! I was pulling my hair out trying to figure why my ES was no longer working.

davolesh commented 3 years ago

I'm only a week+ late but me too!! I was so confused....

It looks like zmeventnotification was updated 5 days ago "Updates pyzm to make sure sqlalchemy is not updated to 1.4", but I had no idea how to downgrade it because I am using "dlandon/zoneminder" in docker on unRaid.

I just went into the console in Zoneminder and ran your command and it worked! Thanks!

dlandon commented 3 years ago

The latest version of ES takes care of this issue.

faspina commented 3 years ago

Thanks all, should have checked here first. Spent 2 hours trying to figure out what happened after a docker restart. Will the dlandon/zoneminder:latest image be updated with the new ES to fix this.

dlandon commented 3 years ago

No. That Docker is no longer supported.