hjelev/rpi-mqtt-monitor

Python Error after Upgrading to 12.0 or 12.1

Opened this issue · 8 comments

I'm not sure which update caused it, it currently says I have 12.1 installed but I don't know if 12.0 ever installed and ran or if it was skipped. Anyway, after updating all my servers the service refuses to start on all of them. I'm getting the following error.

  • 2024-12-01T15:35:56.470181-05:00 ispconfig systemd[1]: rpi-mqtt-monitor.service: Scheduled restart job, restart counter is at 258.
  • 2024-12-01T15:35:56.470546-05:00 ispconfig systemd[1]: Stopped rpi-mqtt-monitor.service - RPI MQTT Monitor.
  • 2024-12-01T15:35:56.498432-05:00 ispconfig systemd[1]: Started rpi-mqtt-monitor.service - RPI MQTT Monitor.
  • 2024-12-01T15:35:56.590265-05:00 ispconfig python3[1093362]: Traceback (most recent call last):
  • 2024-12-01T15:35:56.590449-05:00 ispconfig python3[1093362]: File "/opt/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 23, in
  • 2024-12-01T15:35:56.590528-05:00 ispconfig python3[1093362]: import requests
  • 2024-12-01T15:35:56.590559-05:00 ispconfig python3[1093362]: ModuleNotFoundError: No module named 'requests'
  • 2024-12-01T15:35:56.603988-05:00 ispconfig systemd[1]: rpi-mqtt-monitor.service: Main process exited, code=exited, status=1/FAILURE
  • 2024-12-01T15:35:56.604257-05:00 ispconfig systemd[1]: rpi-mqtt-monitor.service: Failed with result 'exit-code'.

this is because now the script needs a new module
No module named 'requests'
if you reinstall the script this will be solved.
Else you can login in the virtual env. and install it with pip3 install requests

It's strange because requests is in the requirements.txt file. And when I try to install it it's telling me it's already installed. So I dunno what's going on.

I didn't install these, they have been installed and all I tried to do was update them from HA. I have it installed on 7 devices and VM's and 7 are broken.

Edit: you are correct, a reinstall fixes it, I just wish I didn't have to do it!

you can also activate the virtual environment in which the app is installed by executing this from its folder
cd rpi-mqtt-monitor
source rpi_mon_env/bin/activate
and then do
pip3 install -r requirements.txt

I also had this, but just reinstalled, before seeing this issue.

In the last version 1.0.0 I have improved the updater so new python modules will be installed after version update.
So in versions after 1.0.0 new python modules won't be a breaking change.

pipip commented
/opt/rpi-mqtt-monitor$ sudo python3 src/update.py
Current version: 1.0.0
:: Updating git repository /opt/rpi-mqtt-monitor/src
Already up to date.

/bin/bash: line 1: /opt/rpi-mqtt-monitor/rpi_mon_env/bin/pip: cannot execute: required file not found
An error occurred while installing requirements: Command 'source /opt/rpi-mqtt-monitor/rpi_mon_env/bin/activate && pip install -q -r /opt/rpi-mqtt-monitor/requirements.txt' returned non-zero exit status 127.
/opt/rpi-mqtt-monitor$ sudo python3 src/update.py
Current version: 1.0.0
:: Updating git repository /opt/rpi-mqtt-monitor/src
Already up to date.

/bin/bash: line 1: /opt/rpi-mqtt-monitor/rpi_mon_env/bin/pip: cannot execute: required file not found
An error occurred while installing requirements: Command 'source /opt/rpi-mqtt-monitor/rpi_mon_env/bin/activate && pip install -q -r /opt/rpi-mqtt-monitor/requirements.txt' returned non-zero exit status 127.

Why did you installed the script in /opt folder ?
Do you have a virtual environment?
Can you show me the content of the rpi-mqtt-monitor folder.

pipip commented

I installed via
bash <(curl -s https://raw.githubusercontent.com/hjelev/rpi-mqtt-monitor/master/remote_install.sh)
It installs in the current directory. Updating did not work. Reinstalling with command above worked