Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python pip3 cannot install zoneinfo on Linux Debian

Tags:

python

linux

pip

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?

like image 995
Canovice Avatar asked Jul 13 '26 02:07

Canovice


1 Answers

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
like image 185
FlyingTeller Avatar answered Jul 15 '26 16:07

FlyingTeller



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!