Closed majbah-ha closed 1 year ago
I can't seem to replicate the issue you have. Please send me the output of this command:
pip freeze | grep -i flask
Thank you for quick replay here is the outcome
Flask==2.2.2 Flask-Login==0.6.2 Flask-SocketIO==4.3.1
I still can't seem to find why you are having this issue. Please send me the whole output of:
pip freeze
Also try running it manually:
cd /opt/AlarmPI/
sudo python run.py
alarmpi@raspberrypi:~ $ pip freeze bidict==0.22.0 certifi==2020.6.20 chardet==4.0.0 click==8.1.3 colorzero==1.1 distro==1.5.0 Flask==2.2.2 Flask-Login==0.6.2 Flask-SocketIO==4.3.2 gpiozero==1.6.2 idna==2.10 importlib-metadata==5.0.0 itsdangerous==2.1.2 Jinja2==3.1.2 MarkupSafe==2.1.1 numpy==1.19.5 paho-mqtt==1.6.1 picamera2==0.3.6 pidng==4.0.9 piexif==1.1.3 Pillow==8.1.2 python-apt==2.2.1 python-engineio==3.13.2 python-prctl==1.7 python-socketio==4.6.0 pytz==2022.6 requests==2.25.1 RPi.GPIO==0.7.0 simplejpeg==1.6.4 six==1.16.0 spidev==3.5 ssh-import-id==5.10 toml==0.10.1 urllib3==1.26.5 v4l2-python3==0.3.1 Werkzeug==2.2.2 zipp==3.10.0
alarmpi@raspberrypi:~ $ cd /opt/AlarmPI/
alarmpi@raspberrypi:/opt/AlarmPI $ sudo python run.py
Traceback (most recent call last):
File "/opt/AlarmPI/run.py", line 7, in
Try this:
cd /opt/AlarmPI/
sudo pip install -r requirements.txt
pip install -r requirements.txt
and try running it again.
DId not help requirements already satisfied
alarmpi@raspberrypi:~ $ cd /opt/AlarmPI/ alarmpi@raspberrypi:/opt/AlarmPI $ sudo pip install -r requirements.txt Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: Flask>=1.1.1 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 1)) (2.2.2) Requirement already satisfied: Flask-SocketIO==4.3.2 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 2)) (4.3.2) Requirement already satisfied: Flask-Login>=0.4.1 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 3)) (0.6.2) Requirement already satisfied: requests>=2.22.0 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 4)) (2.25.1) Requirement already satisfied: pytz>=2019.2 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 5)) (2022.6) Requirement already satisfied: paho-mqtt>=1.4.0 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 6)) (1.6.1) Requirement already satisfied: RPi.GPIO>=0.7.0 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 7)) (0.7.0) Requirement already satisfied: python-socketio<5,>=4.3.0 in /usr/local/lib/python3.9/dist-packages (from Flask-SocketIO==4.3.2->-r requirements.txt (line 2)) (4.6.1) Requirement already satisfied: importlib-metadata>=3.6.0 in /usr/local/lib/python3.9/dist-packages (from Flask>=1.1.1->-r requirements.txt (line 1)) (5.0.0) Requirement already satisfied: click>=8.0 in /usr/local/lib/python3.9/dist-packages (from Flask>=1.1.1->-r requirements.txt (line 1)) (8.1.3) Requirement already satisfied: Werkzeug>=2.2.2 in /usr/local/lib/python3.9/dist-packages (from Flask>=1.1.1->-r requirements.txt (line 1)) (2.2.2) Requirement already satisfied: Jinja2>=3.0 in /usr/local/lib/python3.9/dist-packages (from Flask>=1.1.1->-r requirements.txt (line 1)) (3.1.2) Requirement already satisfied: itsdangerous>=2.0 in /usr/local/lib/python3.9/dist-packages (from Flask>=1.1.1->-r requirements.txt (line 1)) (2.1.2) Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.9/dist-packages (from importlib-metadata>=3.6.0->Flask>=1.1.1->-r requirements.txt (line 1)) (3.10.0) Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.9/dist-packages (from Jinja2>=3.0->Flask>=1.1.1->-r requirements.txt (line 1)) (2.1.1) Requirement already satisfied: six>=1.9.0 in /usr/lib/python3/dist-packages (from python-socketio<5,>=4.3.0->Flask-SocketIO==4.3.2->-r requirements.txt (line 2)) (1.16.0) Requirement already satisfied: python-engineio<4,>=3.13.0 in /usr/local/lib/python3.9/dist-packages (from python-socketio<5,>=4.3.0->Flask-SocketIO==4.3.2->-r requirements.txt (line 2)) (3.14.2)
alarmpi@raspberrypi:/opt/AlarmPI $ pip install -r requirements.txt Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: Flask>=1.1.1 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 1)) (2.2.2) Requirement already satisfied: Flask-SocketIO==4.3.2 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 2)) (4.3.2) Requirement already satisfied: Flask-Login>=0.4.1 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 3)) (0.6.2) Requirement already satisfied: requests>=2.22.0 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 4)) (2.25.1) Requirement already satisfied: pytz>=2019.2 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 5)) (2022.6) Requirement already satisfied: paho-mqtt>=1.4.0 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 6)) (1.6.1) Requirement already satisfied: RPi.GPIO>=0.7.0 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 7)) (0.7.0) Requirement already satisfied: python-socketio<5,>=4.3.0 in /home/alarmpi/.local/lib/python3.9/site-packages (from Flask-SocketIO==4.3.2->-r requirements.txt (line 2)) (4.6.0) Requirement already satisfied: Werkzeug>=2.2.2 in /home/alarmpi/.local/lib/python3.9/site-packages (from Flask>=1.1.1->-r requirements.txt (line 1)) (2.2.2) Requirement already satisfied: itsdangerous>=2.0 in /usr/local/lib/python3.9/dist-packages (from Flask>=1.1.1->-r requirements.txt (line 1)) (2.1.2) Requirement already satisfied: Jinja2>=3.0 in /usr/local/lib/python3.9/dist-packages (from Flask>=1.1.1->-r requirements.txt (line 1)) (3.1.2) Requirement already satisfied: click>=8.0 in /usr/local/lib/python3.9/dist-packages (from Flask>=1.1.1->-r requirements.txt (line 1)) (8.1.3) Requirement already satisfied: importlib-metadata>=3.6.0 in /usr/local/lib/python3.9/dist-packages (from Flask>=1.1.1->-r requirements.txt (line 1)) (5.0.0) Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.9/dist-packages (from importlib-metadata>=3.6.0->Flask>=1.1.1->-r requirements.txt (line 1)) (3.10.0) Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.9/dist-packages (from Jinja2>=3.0->Flask>=1.1.1->-r requirements.txt (line 1)) (2.1.1) Requirement already satisfied: six>=1.9.0 in /usr/lib/python3/dist-packages (from python-socketio<5,>=4.3.0->Flask-SocketIO==4.3.2->-r requirements.txt (line 2)) (1.16.0) Requirement already satisfied: python-engineio>=3.13.0 in /home/alarmpi/.local/lib/python3.9/site-packages (from python-socketio<5,>=4.3.0->Flask-SocketIO==4.3.2->-r requirements.txt (line 2)) (3.13.2)
alarmpi@raspberrypi:/opt/AlarmPI $ sudo python run.py
Traceback (most recent call last):
File "/opt/AlarmPI/run.py", line 7, in
You can try upgrading one of the packages to the latest version, but it's untested:
sudo pip install -U flask-socketio
That did work partially I got now one error
alarmpi@alarmpi:~ $ sudo systemctl status alarmpi.service β alarmpi.service - AlarmPI Loaded: loaded (/etc/systemd/system/alarmpi.service; enabled; vendor preset: enabled) Active: inactive (dead) since Thu 2022-11-10 14:08:18 GMT; 37s ago Process: 1601 ExecStart=/usr/bin/python3 /opt/AlarmPI/run.py (code=exited, status=0/SUCCESS) Main PID: 1601 (code=exited, status=0/SUCCESS) CPU: 967ms
Nov 10 14:08:17 alarmpi python3[1601]: 2022-11-10 14:08:17 [ERROR] [run:
Ok it seems to be working, but
I changed /usr/local/lib/python3.9/dist-packages/flask_socketio/init.py allow_unsafe_werkzeug=True
then I got this seems everything ok
alarmpi@alarmpi:~ $ sudo systemctl status alarmpi.service β alarmpi.service - AlarmPI Loaded: loaded (/etc/systemd/system/alarmpi.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2022-11-10 14:10:57 GMT; 5s ago Main PID: 1621 (python3) Tasks: 1 (limit: 1830) CPU: 845ms CGroup: /system.slice/alarmpi.service ββ1621 /usr/bin/python3 /opt/AlarmPI/run.py
Nov 10 14:10:57 alarmpi systemd[1]: Started AlarmPI. Nov 10 14:10:58 alarmpi python3[1621]: 2022-11-10 14:10:58 [INFO] [notifier:init:426] ------------ INIT FOR DOOR SENSOR CLASS! ---------------- Nov 10 14:10:58 alarmpi python3[1621]: Serving Flask app "alarmcode.alarmpi" (lazy loading) Nov 10 14:10:58 alarmpi python3[1621]: Environment: production Nov 10 14:10:58 alarmpi python3[1621]: WARNING: This is a development server. Do not use it in a production deployment. Nov 10 14:10:58 alarmpi python3[1621]: Use a production WSGI server instead. Nov 10 14:10:58 alarmpi python3[1621]: * Debug mode: off
BUT .... the web browser is not loading/ not reachable
Which OS did you install on your raspberry? You can find it with this:
lsb_release -a
alarmpi@alarmpi:~ $ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 11 (bullseye) Release: 11 Codename: bullseye
I am using this Raspberry Pi OS Lite Release date: September 22nd 2022 System: 64-bit Kernel version: 5.15 Debian version: 11 (bullseye)
Shall I try the other versions with desktop may be it makes a difference?
I am also using this, but it works for me... The only thing I would suggest is create a fresh installation of your OS and try installing it again. I don't know why it doesn't work for you and how it can be fixed...
Ok I will try that, but it was a fresh install already. I trust you are right, there is something wrong I need to figure out.
I will keep you posted.
Thanks for you time
@majbah-ha Do you have any update for this issue?
Sadly I keep getting the same result even on a fresh install. I am using a CM4 as hardware, maybe it will make a difference if I install it on Rpi 4 or 3 which I also have. I will try that once I am back from vacation.
I stumbled upon this error myself and I figured out how to solve this. I've updated the requirements and the code, so you will have to update to the new version.
I am considering this issue fixed. Feel free to reopen it if you have still issues.
Yesterday fresh installed alarmpi on raspberry pi 4, the installation went without error. When tried to start the program the alarm pi service failed with the following error
β alarmpi.service - AlarmPI Loaded: loaded (/etc/systemd/system/alarmpi.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Thu 2022-11-10 02:08:43 GMT; 6h ago Process: 366 ExecStart=/usr/bin/python3 /opt/AlarmPI/run.py (code=exited, status=1/FAILURE) Main PID: 366 (code=exited, status=1/FAILURE) CPU: 1.316s
Nov 10 02:08:43 raspberrypi python3[366]: File "/opt/AlarmPI/run.py", line 7, in
Nov 10 02:08:43 raspberrypi python3[366]: from alarmcode.alarmpi import AlarmPiServer
Nov 10 02:08:43 raspberrypi python3[366]: File "/opt/AlarmPI/alarmcode/alarmpi.py", line 8, in
Nov 10 02:08:43 raspberrypi python3[366]: from flask_socketio import SocketIO, join_room
Nov 10 02:08:43 raspberrypi python3[366]: File "/usr/local/lib/python3.9/dist-packages/flask_socketio/init.py", line 24, in
Nov 10 02:08:43 raspberrypi python3[366]: from werkzeug.serving import run_with_reloader
Nov 10 02:08:43 raspberrypi python3[366]: ImportError: cannot import name 'run_with_reloader' from 'werkzeug.serving' (/usr/local/lib/python3.9/dist-packages/werkzeug/serving.py)
Nov 10 02:08:43 raspberrypi systemd[1]: alarmpi.service: Main process exited, code=exited, status=1/FAILURE
Nov 10 02:08:43 raspberrypi systemd[1]: alarmpi.service: Failed with result 'exit-code'.
Nov 10 02:08:43 raspberrypi systemd[1]: alarmpi.service: Consumed 1.316s CPU time.
I installed alarm pi on my ubuntu desktop to verify, which also failed with the same error.
Please look at the problem and I am glad to hear your suggestions.
Thanks in advance