Home > Back-end >  python pip3 cannot install zoneinfo on Linux Debian
python pip3 cannot install zoneinfo on Linux Debian

Time:02-19

How can zoneinfo be installed on a Linux Debian 10 machine? our script is working just fine on Mac. When pushed to Linux Debian and run, the script returns the error:

myemail@repo-name:~/path-to/mainfolder$ python3 main_cbb_v2.py
Traceback (most recent call last):
  File "main_cbb_v2.py", line 3, in <module>
    from utils import *
  File "/home/pathto-utils/utils.py", line 16, in <module>
    from zoneinfo import ZoneInfo
ModuleNotFoundError: No module named 'zoneinfo'

and when we attempt to install the library, we get the error:

pip3 install zoneinfo
Collecting zoneinfo
Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url: https://pypi.org/simple
/zoneinfo/

and we get this same exact error even if sudo su is run beforehand. And if backports prefix is used:

pip3 install backports.zoneinfo
Requirement already satisfied: backports.zoneinfo in /usr/local/lib/python3.7/dist-packages (0.2.1)

How can this be troubleshooted further?

CodePudding user response:

zoneinfo is new in python 3.9, so the undelying issue is probably that you have different python versions on different systems. You can either upgrade your python version or you use the backports module which you already have installed, but then your code needs to be:

from backports.zoneinfo import ZoneInfo
  • Related