NetAlertX icon indicating copy to clipboard operation
NetAlertX copied to clipboard

Release 24.3.19: ModuleNotFoundError: No module named 'pytz'

Open somar05 opened this issue 2 years ago β€’ 43 comments

Is there an existing issue for this?

  • [X] I have searched the existing open and closed issues and I checked the docs https://github.com/jokob-sk/Pi.Alert/tree/main/docs

Current Behavior

For release 24.3.19 pi.alert (docker version) can't start. Previous release working with no problems.

Expected Behavior

Just start as previous version

Steps To Reproduce

Update to release 24.3.19

pialert.conf

No response

docker-compose.yml

No response

What branch are you running?

Production

pialert.log

[INSTALL] πŸš€ Starting app - navigate to your <server IP>:20211
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/pi/pialert/pialert/__main__.py", line 27, in <module>
    from helper import  filePermissions, timeNowTZ, updateState, get_setting_value
  File "/home/pi/pialert/pialert/helper.py", line 10, in <module>
    import pytz
ModuleNotFoundError: No module named 'pytz'

Debug enabled

  • [X] I have read and followed the steps in the wiki link above and provided the required debug logs and the log section covers the time when the issue occurs.

somar05 avatar Mar 19 '24 04:03 somar05

Hi,

Do you have by the TZ environment variable specified in the docker compose file? Can you please add it if you don't to test this? If tuΕ‘Γ­ does not work, can you please post your docker compose?

Thanks, J

On Tue, 19 Mar 2024, 15:44 somar05, @.***> wrote:

Is there an existing issue for this?

  • I have searched the existing open and closed issues and I checked the docs https://github.com/jokob-sk/Pi.Alert/tree/main/docs

Current Behavior

For release 24.3.19 pi.alert (docker version) can't start. Previous release working with no problems. Expected Behavior

Just start as previous version Steps To Reproduce

Update to release 24.3.19 pialert.conf

No response docker-compose.yml

No response What branch are you running?

Production pialert.log

[INSTALL] πŸš€ Starting app - navigate to your :20211 Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/home/pi/pialert/pialert/main.py", line 27, in from helper import filePermissions, timeNowTZ, updateState, get_setting_value File "/home/pi/pialert/pialert/helper.py", line 10, in import pytz ModuleNotFoundError: No module named 'pytz' Debug enabled

  • I have read and followed the steps in the wiki link above and provided the required debug logs and the log section covers the time when the issue occurs.

β€” Reply to this email directly, view it on GitHub https://github.com/jokob-sk/Pi.Alert/issues/593, or unsubscribe https://github.com/notifications/unsubscribe-auth/AW5URDCA622W3GHUJEYAXSTYY67DFAVCNFSM6AAAAABE42DUYCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE4TIMBQHEZDKMQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jokob-sk avatar Mar 19 '24 05:03 jokob-sk

Hi @jokob-sk I have tried with a different TZ (Europa\Berlin) just to check it, but unsuccesfully. Anyway, that's my config (basically, the default one):

docker run -d --rm --network=host
-v /home/contenedores/pialert/config:/home/pi/pialert/config
-v /home/contenedores/pialert/db:/home/pi/pialert/db
-e TZ=Europe/Madrid
-e PORT=20211
jokobsk/pi.alert:latest

  • Edited. Sorry

somar05 avatar Mar 19 '24 05:03 somar05

Thanks for checking - I think this might be related, can you please try to completely remove the TZ variable? See this comment: https://github.com/jokob-sk/Pi.Alert/discussions/588#discussioncomment-8815456

On Tue, 19 Mar 2024, 16:12 somar05, @.***> wrote:

Hi @jokob-sk https://github.com/jokob-sk I have tried with a different TZ (Europa\Berlin) just to check it, but unsuccesfully. Anyway, that's my config (basically, the default one):

docker run -d --rm --network=host -v /home/contenedores/pialert/config:/home/pi/pialert/config -v /home/contenedores/pialert/db:/home/pi/pialert/db -v /home/contenedores/pialert/front/api:/home/pi/pialert/front/api -e TZ=Europe/Madrid -e PORT=20211 jokobsk/pi.alert:latest

β€” Reply to this email directly, view it on GitHub https://github.com/jokob-sk/Pi.Alert/issues/593#issuecomment-2005777134, or unsubscribe https://github.com/notifications/unsubscribe-auth/AW5URDEIZMV3IDF5TR3V4TTYY7CLFAVCNFSM6AAAAABE42DUYCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBVG43TOMJTGQ . You are receiving this because you were mentioned.Message ID: <jokob-sk/Pi .@.***>

jokob-sk avatar Mar 19 '24 05:03 jokob-sk

Removed TZ as Env variable, but same error.

somar05 avatar Mar 19 '24 05:03 somar05

Hummm, weird, I have an up to date clean container setup with the latest build but didn't get this error message.

What architecture are you on?

FYI @vladaurosh

On Tue, 19 Mar 2024, 16:28 somar05, @.***> wrote:

Removed TZ as Env variable, but same error.

β€” Reply to this email directly, view it on GitHub https://github.com/jokob-sk/Pi.Alert/issues/593#issuecomment-2005800215, or unsubscribe https://github.com/notifications/unsubscribe-auth/AW5URDG3CG6ACUDRQ45A5F3YY7EJJAVCNFSM6AAAAABE42DUYCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBVHAYDAMRRGU . You are receiving this because you were mentioned.Message ID: <jokob-sk/Pi .@.***>

jokob-sk avatar Mar 19 '24 05:03 jokob-sk

x86 with ubuntu 22.04

Later on I'll try a fresh installation instead a update one. Maybe it's related with the update?

somar05 avatar Mar 19 '24 05:03 somar05

Hummm,

I just tried on my Ubuntu x86 setup with this simplified docker-compose and it works fine:

version: "3"
services:
  pialert:
    container_name: pialert
    image: "jokobsk/pi.alert"
    network_mode: "host"
    restart: unless-stopped
#    volumes:
#      - ${APP_DATA_LOCATION}/pialert/config:/home/pi/pialert/config
#      - ${APP_DATA_LOCATION}/pialert/db:/home/pi/pialert/db
#      - ${APP_DATA_LOCATION}/pialert/db/setting_darkmode:/home/pi/pialert/db/setting_darkmode
#      - ${LOGS_LOCATION}/:/home/pi/pialert/front/log
    environment:
      - TZ=Australia/Sydney
      - HOST_USER_ID=1036
      - HOST_USER_GID=1000
      - PORT=20241

pinging @BambamNZ as he dealt probably with a similar issue when testing the pi.alert_dev container.

jokob-sk avatar Mar 19 '24 06:03 jokob-sk

@somar05 do you have by chance a TIMEZONE setting in your pialert.conf? If no can you try adding it? If yes, can you try removing it?

jokob-sk avatar Mar 19 '24 06:03 jokob-sk

I had it: TIMEZONE='Europe/Madrid' TIMEZONE__metadata={}"

Removed, but with no result (also removed the TZ from Env variable)

somar05 avatar Mar 19 '24 06:03 somar05

Thanks for checking - I rolled back some code dealing with the TZ variable in the setup script - let's see if that works. Can you try switching temporarily to the pi.alert_dev image after this build finishes? https://github.com/jokob-sk/Pi.Alert/actions/runs/8338409230 This will probably be ready in 5-10 min.

jokob-sk avatar Mar 19 '24 06:03 jokob-sk

@jokob-sk sorry, but how can I switch to dev? I mean, I use docker run... and only stable releases are available. Sorry for the inconvenience

somar05 avatar Mar 19 '24 06:03 somar05

I've just loaded a new container with the dev:latest image including a "TZ" variable and it launched without any issues

BambamNZ avatar Mar 19 '24 06:03 BambamNZ

Hey,

You just replace the image name:

docker run -d --rm --network=host -v /home/contenedores/pialert/config:/home/pi/pialert/config -v /home/contenedores/pialert/db:/home/pi/pialert/db -v /home/contenedores/pialert/front/api:/home/pi/pialert/front/api -e TZ=Europe/Madrid -e PORT=20211 jokobsk/pi.alert_dev:latest

On Tue, 19 Mar 2024, 17:26 somar05, @.***> wrote:

@jokob-sk https://github.com/jokob-sk sorry, but how can I switch to dev? I mean, I use docker run... and only stable releases are available. Sorry for the inconvenience

β€” Reply to this email directly, view it on GitHub https://github.com/jokob-sk/Pi.Alert/issues/593#issuecomment-2005904061, or unsubscribe https://github.com/notifications/unsubscribe-auth/AW5URDFZYT5SOWEJIEZGGALYY7LCDAVCNFSM6AAAAABE42DUYCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBVHEYDIMBWGE . You are receiving this because you were mentioned.Message ID: <jokob-sk/Pi .@.***>

jokob-sk avatar Mar 19 '24 06:03 jokob-sk

Thanks @BambamNZ for checking πŸ™ let's see if @somar05 has any luck

On Tue, 19 Mar 2024, 17:29 BambamNZ, @.***> wrote:

I've just loaded a new container with the dev:latest image including a "TZ" variable and it launched without any issues

β€” Reply to this email directly, view it on GitHub https://github.com/jokob-sk/Pi.Alert/issues/593#issuecomment-2005913466, or unsubscribe https://github.com/notifications/unsubscribe-auth/AW5URDFRADY3TW7QSFEQNM3YY7LOJAVCNFSM6AAAAABE42DUYCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBVHEYTGNBWGY . You are receiving this because you were mentioned.Message ID: <jokob-sk/Pi .@.***>

jokob-sk avatar Mar 19 '24 06:03 jokob-sk

No luck by now. Sorry. I'll try a fresh install in a few hours. Thanks for your help

somar05 avatar Mar 19 '24 06:03 somar05

Okay, fingers crossed. 🀞 Please keep me posted. I hope most user's installations are fine.

If you need to restore a backup, check these docs: https://github.com/jokob-sk/Pi.Alert/blob/main/docs/BACKUPS.md

On Tue, 19 Mar 2024, 17:41 somar05, @.***> wrote:

No luck by now. Sorry. I'll try a fresh install in a few hours. Thanks for your help

β€” Reply to this email directly, view it on GitHub https://github.com/jokob-sk/Pi.Alert/issues/593#issuecomment-2005949444, or unsubscribe https://github.com/notifications/unsubscribe-auth/AW5URDHWWHKLG7RY5IA7ODLYY7MYLAVCNFSM6AAAAABE42DUYCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBVHE2DSNBUGQ . You are receiving this because you were mentioned.Message ID: <jokob-sk/Pi .@.***>

jokob-sk avatar Mar 19 '24 06:03 jokob-sk

Hi again. Finally no luck with the dev nor with the latest (24.3.19). The error persist. However, with a fresh installation (24.3.19) and recovering the config file and the database the container is working like a charm. Something should be wrong in my previous version that can't be updated and no idea what relationship can have with the "TZ".

Anyway, thks to @jokob-sk and @BambamNZ for the help, and specially to @jokob-sk for your job.

somar05 avatar Mar 19 '24 15:03 somar05

@somar05 Thanks a lot for reporting back. It is definitely weird, but I'm glad to hear a fresh install is working. I will close this for now as resolved and re-open if needed.

jokob-sk avatar Mar 19 '24 20:03 jokob-sk

Combining 2 threads, @TheCBiker has the same issue, with the below setup:

I will try to debug this further in a few hours.

pialert.conf

# General
#---------------------------
LOG_LEVEL='minimal'
LOG_LEVEL__metadata="{}"
TIMEZONE='Europe/Berlin'
TIMEZONE__metadata="{}"
PLUGINS_KEEP_HIST=10000
PLUGINS_KEEP_HIST__metadata="{}"
PIALERT_WEB_PROTECTION=True
PIALERT_WEB_PROTECTION__metadata="{}"
PIALERT_WEB_PASSWORD='********************'
PIALERT_WEB_PASSWORD__metadata="{}"
REPORT_DASHBOARD_URL='http://*********:20211'
REPORT_DASHBOARD_URL__metadata="{}"
UI_LANG='English'
UI_LANG__metadata="{}"
UI_PRESENCE=['online','offline','archived']
UI_PRESENCE__metadata="{}"
UI_MY_DEVICES=['online','offline','archived','new','down']
UI_MY_DEVICES__metadata="{}"
UI_NOT_RANDOM_MAC=[]
UI_NOT_RANDOM_MAC__metadata="{}"
DAYS_TO_KEEP_EVENTS=90
DAYS_TO_KEEP_EVENTS__metadata="{}"
HRS_TO_KEEP_NEWDEV=0
HRS_TO_KEEP_NEWDEV__metadata="{}"
API_CUSTOM_SQL='SELECT * FROM Devices WHERE dev_PresentLastScan = 0'
API_CUSTOM_SQL__metadata="{}"
NETWORK_DEVICE_TYPES=['AP','Gateway','Firewall','Hypervisor','Powerline','Switch','WLAN','PLC','Router','USB LAN Adapter','USB WIFI Adapter','Internet','Repeater']
NETWORK_DEVICE_TYPES__metadata="{}"

docker-compose.yml

version: "3"
services:
  pialert:
    container_name: pialert
    image: "jokobsk/pi.alert:latest"      
    network_mode: "host"        
    restart: unless-stopped
    volumes:
      - /portainer/Files/AppData/Config/pi.alert/log:/home/pi/pialert/front/log
      - /portainer/Files/AppData/Config/pi.alert/config:/home/pi/pialert/config
      - /portainer/Files/AppData/Config/pi.alert/db:/home/pi/pialert/db
    environment:
      - TZ=Europe/Berlin      
      - HOST_USER_ID=1000
      - HOST_USER_GID=1000
      - PORT=20211

jokob-sk avatar Mar 19 '24 21:03 jokob-sk

Hummm, weird, I have an up to date clean container setup with the latest build but didn't get this error message. What architecture are you on? FYI @vladaurosh … On Tue, 19 Mar 2024, 16:28 somar05, @.> wrote: Removed TZ as Env variable, but same error. β€” Reply to this email directly, view it on GitHub <#593 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AW5URDG3CG6ACUDRQ45A5F3YY7EJJAVCNFSM6AAAAABE42DUYCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBVHAYDAMRRGU . You are receiving this because you were mentioned.Message ID: <jokob-sk/Pi .@.>

Hey @jokob-sk

Did you guys manage to figure this out? This would indicate that python module pytz is not installed, but it is. :|

vladaurosh avatar Mar 19 '24 21:03 vladaurosh