AutomaThemely icon indicating copy to clipboard operation
AutomaThemely copied to clipboard

ModuleNotFoundError: No module named 'pytz'

Open iHad168 opened this issue 2 years ago • 1 comments

[localhost@localhost-PC ~]$ automathemely --manage
Traceback (most recent call last):
  File "/usr/bin/automathemely", line 33, in <module>
    sys.exit(load_entry_point('AutomaThemely==1.3', 'console_scripts', 'automathemely')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/automathemely", line 25, in importlib_load_entry_point
    return next(matches).load()
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/metadata/__init__.py", line 202, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3.11/site-packages/automathemely/bin/run.py", line 11, in <module>
    import pytz
ModuleNotFoundError: No module named 'pytz'
                 x;XxXB%89b8:b8%b88:              -----------------
              .8Xxd                8X:.           OS: Garuda Linux x86_64
            .8Xx;                    8x:.         Host: B550M DS3H -CF
          .tt8x          .d            x88;       Kernel: 6.7.0-rc3-1-mainline
       .@8x8;          .db:              xx@;     Uptime: 1 day, 2 hours, 3 mins
     ,tSXX°          .bbbbbbbbbbbbbbbbbbbB8x@;    Packages: 1523 (pacman)[stable]
   .SXxx            bBBBBBBBBBBBBBBBBBBBbSBX8;    Shell: fish 3.6.1
 ,888S                                     pd!    Resolution: 2560x1080
8X88/                                       q     DE: KDE Plasma 5.27.9
8X88/                                             WM: KWin (X11)
GBB.                                              WM Theme: Sweet-Dark
 x%88        d888@8@X@X@X88X@@XX@@X@8@X.          Theme: Breeze (Light) [QT], Vapor [GTK2], Sweet-Dark [GTK3/}
   dxXd    dB8b8b8B8B08bB88b998888b88x.           Icons: Breeze [QT], BeautyLine [GTK3/4]
    dxx8o                      .@@;.              Terminal: konsole 23.08.2
      dx88                   .t@x.                Terminal Font: FiraCode Nerd Font Mono 12
        d:SS@8ba89aa67a853Sxxad.                  CPU: AMD Ryzen 9 3900X (24) @ 4.71 GHz
          .d988999889889899dd.                    GPU: AMD Radeon RX 6700 XT
                                                  Memory: 15.20 GiB / 31.25 GiB
 ╭─root@localhost in ~ as 🧙 
 ╰─λ python
Python 3.11.5 (main, Sep  2 2023, 14:16:33) [GCC 13.2.1 20230801] on linux
Type "help", "copyright", "credits" or "license" for more information.

iHad168 avatar Dec 09 '23 01:12 iHad168

First check if you have the needed functionality installed: pip show pytz pip show tzlocal ( Ideally inside the isolated python bin, else in your user space or system space (sudo, not recommended))

If not: pip install pytz tzlocal

That should solve the problem. I would say you are almost there.

Next you might have some stuff commented out in your 'updsuntimes.py' script that will cause a message: 'NameError: name 'pytz' is not defined'

Uncommment the commented lines at the start: import logging from datetime import timedelta from datetime import date from time import sleep

#import pytz #import tzlocal from astral import LocationInfo from astral.sun import sun

...and you should be good to go! I have Automathemely still running in an ubuntu 22.04 env on python3.10 from an isolated space. I love the app and think it should be incorporated with any good Desktop Environment. A script in KDE makes sure the backgounds (multimonitor) follow the light/ dark theme.

ShonkaiDJ avatar Nov 08 '24 11:11 ShonkaiDJ