Closed aaronsta1 closed 4 years ago
zm_detect py invokes /usr/bin/python3 (https://github.com/pliablepixels/zmeventnotification/blob/master/hook/zm_detect.py#L1) - make sure you are testing with that python. Chances are when you are running python from CLI you are not invoking that interpreter
no i typed in python3 to run python, check the version, 3.8.5 not 2.7
That doesn't mean you are running the same python zm_detect.py is using.
On your CLI , type in /usr/bin/python3
once loaded, does import cv2 work?
My guess is you've installed cv2 for the python interpreter sitting in /usr/local/bin/python3 not /usr/bin/python3
aaron@aaron-700-214:~$ /usr/bin/python3 Python 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.
import cv2 print(cv2.version) 4.3.0
And how about, from CLI
sudo -u www-data /usr/bin/python3
and import cv2? (assuming www-data is your web user)
ok that does not work aaron@aaron-700-214:~$ sudo -u www-data /usr/bin/python3 [sudo] password for aaron: Python 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.
import cv2 Traceback (most recent call last): File "
", line 1, in ModuleNotFoundError: No module named 'cv2'
In that case, my guess is cv2 was probably installed for a specific user. You should review how you installed it (opencv forums/guides may have more info)
hmm, i didnt see any options in the build and when i ran make install i sudo'd it so it should have been ran as root? it installed in /usr/local/lib/python3.8/site-packages/cv2/python-3.8/ i also put a sh script to export the path in /etc/profile.d/ that should get ran at system startup for each user?
i guess ill have to rebuild everything from scratch but for now i have one more question.
also one other thing, in the app i set each monitor to only send an event every 5 minutes.. and they dont do that, i get back to back events as long as there is motion.
i turned off the hook but now when i have motion i get 2 push messages.. one from motion all and one from event end. is there a way to make it only send one per event?
https://github.com/pliablepixels/zmeventnotification/blob/master/zmeventnotification.ini#L174
also one other thing, in the app i set each monitor to only send an event every 5 minutes.. and they dont do that, i get back to back events as long as there is motion.
I am going to close this out as the original issue was identified to be an incorrect cv2 install. Please feel free to open another issue (but please read the docs/comments in ini files before that)
sorry if this isnt the right spot to ask.. but im have no idea what is going on. when i run zm_detect.py it says this.
Traceback (most recent call last): File "/var/lib/zmeventnotification/bin/zm_detect.py", line 15, in
import imutils
File "/usr/local/lib/python3.8/dist-packages/imutils/init.py", line 8, in
from .convenience import translate
File "/usr/local/lib/python3.8/dist-packages/imutils/convenience.py", line 6, in
import cv2
ModuleNotFoundError: No module named 'cv2'
the thing is i have compiled cv2 and its currently installed in /usr/local/lib/python3.8/site-packages/cv2/python-3.8/cv2.so
also when i run python3 and type in import cv2 it works?? Python 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.
i have no idea why this isnt working. i also made a sh script in /etc/profile.d to export the PYTHONPATH to /usr/local/lib/python3.8/site-packages/cv2/python-3.8/ but that didnt help. ive searched online for help, but nothing is working.