Python 3.9 package is missing dependency on tzdata

Bug #1904271 reported by Christian Heimes
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python3.9 (Ubuntu)
Confirmed
Wishlist
Unassigned

Bug Description

Python 3.9 introduced the stdlib module "zoneinfo". The module either uses the operating sytem's tzdata database or the tzdata Python package. See https://www.python.org/dev/peps/pep-0615/ for more information.

Debian's and Ubuntu's python3.9 package is missing a dependency on tzdata. This breaks the zoneinfo module in a minimal container:

$ docker run -ti ubuntu:groovy /bin/bash
# apt update
# apt install -y python3.9
# dpkg -l python3.9
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=============================================================
ii python3.9 3.9.0-5 amd64 Interactive high-level object-oriented language (version 3.9)
# python3.9 -c 'import zoneinfo; zoneinfo.ZoneInfo("CET")'
...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.9/zoneinfo/_common.py", line 24, in load_tzdata
    raise ZoneInfoNotFoundError(f"No time zone found with key {key}")
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key CET'

Anthony Sottile addressed the issue in his Deadsnakes PPA already, https://github.com/deadsnakes/python3.9/commit/d8216a1f585dac9db805d4e3c57f29535cf84cf8

Revision history for this message
Christian Heimes (heimes) wrote :

# export DEBIAN_FRONTEND="noninteractive"
# apt install -yq tzdata
# python3.9 -c 'import zoneinfo; print(zoneinfo.ZoneInfo("CET"))'
CET

tags: added: groovy packaging
Revision history for this message
Matthias Klose (doko) wrote :

tzdata is a required package. See Debian policy 2.5.

Changed in python3.9 (Ubuntu):
status: New → Invalid
Revision history for this message
Christian Heimes (heimes) wrote :

Required or not, it's not part of the Ubuntu container image and therefore not available in minimal container setups. My initial comment contains a reproducer for the issue. It shows that zoneinfo module is broken in Ubuntu Groovy container.

Revision history for this message
Paul G (p-ganssle) wrote :

As I mentioned on the Arch Linux tracker, I think there are good reasons for declaring an explicit dependency on tzdata even if it the dependency should be satisfied transitively or implicitly: https://bugs.archlinux.org/task/68642?project=1&string=python

Presumably it doesn't hurt anything to explicitly add a dependency on this (since the reason for *not* doing so is that the package is already required), and it would prevent bugs like the one that Christian pointed out.

Revision history for this message
Colin Watson (cjwatson) wrote :

Matthias, your comment #2 is mistaken for two reasons:

 * In Ubuntu, tzdata is Priority: important, not Priority: required.
 * Only dependencies on Essential packages may be omitted; merely being Priority: required is not sufficient. See Debian policy 3.5.

Changed in python3.9 (Ubuntu):
status: Invalid → New
tags: added: rls-gg-incoming
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

we just removed tzdata to be not required.

and it will make core snaps larger, because normally we exclude tzdata from minimal installs.

Changed in python3.9 (Ubuntu):
status: New → Confirmed
importance: Undecided → Wishlist
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Installing -full package will pull in all the things and make all the things work.

We absolutely have a wrath of people complaining about the size of tzdata and that it must not be in their containers / systems, even though they otherwise use python.

so would you rather not ship zoneinfo module, such that the import fails? and then move it to like python3-zoneinfo package and make regular std recommend it, but not depend on it.

That way classic server / desktop installs have it, but specifically docker containers will not, because they are required to ship without tzdata.

if i recall correctly, we only ship minimal docker containers with just the UTC timezone. Such that lookups of UTC should work.

At the moment, the way we ship python is a compromise between the wrath of people who deploy these things in production and demand to shrink the size of python and its deps. And the polar oposite of the typical desire to have all the things enabled / ship all the things.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.