Fixing zenipy errors, dependency pytz no longer there and then No module named gi after that was fixed

Original problem that happened suddenly. Literally had worked the day before.

$ python3 pomodoroprompt.py
Traceback (most recent call last):
  File "/home/mlncn/Projects/agaric/pomodoroprompt/pomodoroprompt.py", line 6, in <module>
    from pytz import timezone
ModuleNotFoundError: No module named 'pytz'

OK fine re-install my requirements:

$ python3 -m pip install --user -r requirements.txt
Collecting playsound
  Using cached playsound-1.2.2-py2.py3-none-any.whl (6.0 kB)
Collecting pytz
  Using cached pytz-2020.4-py2.py3-none-any.whl (509 kB)
Collecting tzlocal
  Using cached tzlocal-2.1-py2.py3-none-any.whl (16 kB)
Collecting zenipy
  Using cached zenipy-0.1.5.tar.gz (6.0 kB)
Building wheels for collected packages: zenipy
  Building wheel for zenipy (setup.py) ... done
  Created wheel for zenipy: filename=zenipy-0.1.5-py3-none-any.whl size=5512 sha256=d10c3a6243eba72d341f22b300daf79ffd5af0f77f3bdd5a6ccdd0a5caf8cbd7
  Stored in directory: /home/mlncn/.cache/pip/wheels/04/07/33/1862fa401df84efd9ff12cf96e20b08996c854f66f12dbd4ec
Successfully built zenipy
Installing collected packages: pytz, zenipy, tzlocal, playsound
Successfully installed playsound-1.2.2 pytz-2020.4 tzlocal-2.1 zenipy-0.1.5

But:

$ python3 pomodoroprompt.py
Traceback (most recent call last):
  File "/home/mlncn/Projects/agaric/pomodoroprompt/pomodoroprompt.py", line 10, in <module>
    import zenipy
  File "/home/mlncn/.local/lib/python3.9/site-packages/zenipy/__init__.py", line 1, in <module>
    from .zenipy import (
  File "/home/mlncn/.local/lib/python3.9/site-packages/zenipy/zenipy.py", line 4, in <module>
    import gi
ModuleNotFoundError: No module named 'gi'

Gi cannot be added to the requirements directly.

Could not find a version that satisfies the requirement gi

But after adding pycairo and PyGObject to the requirements, and reinstalling them:

$ python3 -m pip install --user -r requirements.txt
Requirement already satisfied: playsound in /home/mlncn/.local/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (1.2.2)
Requirement already satisfied: pycairo in /home/mlncn/.local/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (1.20.0)
Requirement already satisfied: pytz in /home/mlncn/.local/lib/python3.9/site-packages (from -r requirements.txt (line 4)) (2020.4)
Requirement already satisfied: tzlocal in /home/mlncn/.local/lib/python3.9/site-packages (from -r requirements.txt (line 5)) (2.1)
Requirement already satisfied: zenipy in /home/mlncn/.local/lib/python3.9/site-packages (from -r requirements.txt (line 6)) (0.1.5)
Collecting PyGObject
  Downloading PyGObject-3.38.0.tar.gz (712 kB)
     |████████████████████████████████| 712 kB 54 kB/s
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: pycairo in /home/mlncn/.local/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (1.20.0)
Requirement already satisfied: pytz in /home/mlncn/.local/lib/python3.9/site-packages (from -r requirements.txt (line 4)) (2020.4)
Building wheels for collected packages: PyGObject
  Building wheel for PyGObject (PEP 517) ... done
  Created wheel for PyGObject: filename=PyGObject-3.38.0-cp39-cp39-linux_x86_64.whl size=718547 sha256=7c7b948edc3c8b7f694072e372e738b2ae2c88c9bc4d4a07dd19b799897b0ca3
  Stored in directory: /home/mlncn/.cache/pip/wheels/f8/73/0f/6972f85c94d2d754c596281556f14acdbf7911089a3b372cae
Successfully built PyGObject
Installing collected packages: PyGObject
Successfully installed PyGObject-3.38.0

It finally worked.

Note that i also ran:

$ sudo apt install python3-gi python3-gi-cairo gir1.2-gtk-3.0

but that didn’t do anything because they were all already there, for me.