ZMES hooks install error

Discussion topics related to mobile applications and ZoneMinder Event Server (including machine learning)
Post Reply
rcrail
Posts: 11
Joined: Fri Jan 10, 2020 10:46 pm

ZMES hooks install error

Post by rcrail »

ZM 1.36, ZMES 6.1.28 on Ubuntu 24.04. When installing ZMES with hooks, the follow is reported:
(Note: no issues/errors running ZM or ZMES without hooks.)



Traceback (most recent call last):
File "/home/dick/zmeventnotification/./hook/zm_detect.py", line 27, in <module>
import zmes_hook_helpers.utils as utils
File "/home/dick/zmeventnotification/hook/zmes_hook_helpers/utils.py", line 21, in <module>
from future import standard_library
File "/usr/lib/python3/dist-packages/future/standard_library/__init__.py", line 65, in <module>
import imp
ModuleNotFoundError: No module named 'imp'
Failed to detect hooks version.

Seems to be 2 different errors.

I would appreciate any suggestions on how to fix these issues.
rcrail
Posts: 11
Joined: Fri Jan 10, 2020 10:46 pm

Re: ZMES hooks install error

Post by rcrail »

UPDATE:

Still trying to get Hooks installed but without success.

install.sh has section:

echo "Removing old version of zmes_hook_helpers, if any"
${PY_SUDO} ${PIP} uninstall -y zmes-hooks >/dev/null 2>&1
${PY_SUDO} ${PIP} uninstall -y zmes_hook_helpers >/dev/null 2>&1


ZM_DETECT_VERSION=`./hook/zm_detect.py --bareversion`
if [ "$ZM_DETECT_VERSION" == "" ]; then
echo "Failed to detect hooks version."
else
echo "__version__ = \"${ZM_DETECT_VERSION}\"" > hook/zmes_hook_helpers/__init__.py
echo "VERSION=__version__" >> hook/zmes_hook_helpers/__init__.py
fi

Verified that ~/zmnotification/hook/zmes_hook_helpers/__init__.py exists

Install error returns:

Removing old version of zmes_hook_helpers, if any
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
ERROR:python hooks setup failed

The above doesn't give a definitive package to install.

Testing:
sudo -u www-data /var/lib/zmeventnotification/bin/zm_event_start.sh 96 1
Traceback (most recent call last):
File "/var/lib/zmeventnotification/bin/zm_detect.py", line 27, in <module>
import zmes_hook_helpers.utils as utils
ModuleNotFoundError: No module named 'zmes_hook_helpers'

Tried following the thread at: https://github.com/ZoneMinder/zmeventno ... issues/391 but this didn't fix the issue.

So somehow zmes_hook_helpers isn't getting installed. Any ideas would be appreciated
User avatar
burger
Posts: 442
Joined: Mon May 11, 2020 4:32 pm

Re: ZMES hooks install error

Post by burger »

rcrail wrote: Sun Oct 20, 2024 7:50 pm You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
I think it's the same thing you ran into here: viewtopic.php?p=135790#p135790

You have to edit the script though, you don't want to just install pyzm. There is a variable for pip, and you have to edit the variable so ALL calls to pip have break system packages included.

Or, so I thought until I looked at my install.sh. Disregard what I said above. The place in the install.sh I added the --break-system-packages was here:

Code: Select all

${PY_SUDO} ${PIP} -v install --break-system-packages hook/ && print_opencv_message || print_error "python hooks setup fail
ed"
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl

If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
rcrail
Posts: 11
Joined: Fri Jan 10, 2020 10:46 pm

SOLVED: ZMES hooks install error

Post by rcrail »

That was it!!!!!

I modified install.sh as suggested, re-ran the script, double checked configuration files and ran a test. All good: no errors. Started the eventserver.

Thank you so much!!
Post Reply