tzdata error when upgrading from 3.2.7 to 3.2.8 #6803

Closed
opened 2025-12-29 19:45:34 +01:00 by adam · 13 comments
Owner

Originally created by @saschapapini on GitHub (Aug 12, 2022).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.2.8

Python version

3.10

Steps to Reproduce

Upgrading from 3.2.7 to 3.2.8

Expected Behavior

smooth upgrade

Observed Behavior

An error was thrown related to 'tzdata'

` Successfully installed django-auth-ldap-4.1.0 pyasn1-0.4.8 pyasn1-modules-0.2.8 python-ldap-3.4.2
Applying database migrations (python3 netbox/manage.py migrate)...
Traceback (most recent call last):
File "/usr/lib/python3.10/zoneinfo/_common.py", line 12, in load_tzdata
return importlib.resources.open_binary(package_name, resource_name)
File "/usr/lib/python3.10/importlib/resources.py", line 46, in open_binary
return reader.open_resource(resource)
File "/usr/lib/python3.10/importlib/abc.py", line 433, in open_resource
return self.files().joinpath(resource).open('rb')
File "/usr/lib/python3.10/pathlib.py", line 1117, in open
return self._accessor.open(self, mode, buffering, encoding, errors,
FileNotFoundError: [Errno 2] No such file or directory: '/opt/netbox-3.2.8/venv/lib/python3.10/site-packages/tzdata/zoneinfo/Asia/Hanoi'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/netbox-3.2.8/netbox/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox-3.2.8/venv/lib/python3.10/site-packages/django/core/management/init.py", line 446, in execute_from_command_line
utility.execute()
File "/opt/netbox-3.2.8/venv/lib/python3.10/site-packages/django/core/management/init.py", line 420, in execute
django.setup()
File "/opt/netbox-3.2.8/venv/lib/python3.10/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/opt/netbox-3.2.8/venv/lib/python3.10/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/opt/netbox-3.2.8/venv/lib/python3.10/site-packages/django/apps/config.py", line 228, in create
import_module(entry)
File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/opt/netbox-3.2.8/venv/lib/python3.10/site-packages/timezone_field/init.py", line 1, in
from timezone_field.fields import TimeZoneField
File "/opt/netbox-3.2.8/venv/lib/python3.10/site-packages/timezone_field/fields.py", line 11, in
class TimeZoneField(models.Field):
File "/opt/netbox-3.2.8/venv/lib/python3.10/site-packages/timezone_field/fields.py", line 41, in TimeZoneField
default_zoneinfo_tzs = [ZoneInfo(tz) for tz in pytz.common_timezones]
File "/opt/netbox-3.2.8/venv/lib/python3.10/site-packages/timezone_field/fields.py", line 41, in
default_zoneinfo_tzs = [ZoneInfo(tz) for tz in pytz.common_timezones]
File "/usr/lib/python3.10/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 Asia/Hanoi' `

Python3 version 3.10.4
OS Ubuntu 22.04.1 LTS

Originally created by @saschapapini on GitHub (Aug 12, 2022). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.2.8 ### Python version 3.10 ### Steps to Reproduce Upgrading from 3.2.7 to 3.2.8 ### Expected Behavior smooth upgrade ### Observed Behavior An error was thrown related to 'tzdata' ` Successfully installed django-auth-ldap-4.1.0 pyasn1-0.4.8 pyasn1-modules-0.2.8 python-ldap-3.4.2 Applying database migrations (python3 netbox/manage.py migrate)... Traceback (most recent call last): File "/usr/lib/python3.10/zoneinfo/_common.py", line 12, in load_tzdata return importlib.resources.open_binary(package_name, resource_name) File "/usr/lib/python3.10/importlib/resources.py", line 46, in open_binary return reader.open_resource(resource) File "/usr/lib/python3.10/importlib/abc.py", line 433, in open_resource return self.files().joinpath(resource).open('rb') File "/usr/lib/python3.10/pathlib.py", line 1117, in open return self._accessor.open(self, mode, buffering, encoding, errors, FileNotFoundError: [Errno 2] No such file or directory: '/opt/netbox-3.2.8/venv/lib/python3.10/site-packages/tzdata/zoneinfo/Asia/Hanoi' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/netbox-3.2.8/netbox/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/opt/netbox-3.2.8/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line utility.execute() File "/opt/netbox-3.2.8/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 420, in execute django.setup() File "/opt/netbox-3.2.8/venv/lib/python3.10/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/opt/netbox-3.2.8/venv/lib/python3.10/site-packages/django/apps/registry.py", line 91, in populate app_config = AppConfig.create(entry) File "/opt/netbox-3.2.8/venv/lib/python3.10/site-packages/django/apps/config.py", line 228, in create import_module(entry) File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1050, in _gcd_import File "<frozen importlib._bootstrap>", line 1027, in _find_and_load File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 688, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 883, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "/opt/netbox-3.2.8/venv/lib/python3.10/site-packages/timezone_field/__init__.py", line 1, in <module> from timezone_field.fields import TimeZoneField File "/opt/netbox-3.2.8/venv/lib/python3.10/site-packages/timezone_field/fields.py", line 11, in <module> class TimeZoneField(models.Field): File "/opt/netbox-3.2.8/venv/lib/python3.10/site-packages/timezone_field/fields.py", line 41, in TimeZoneField default_zoneinfo_tzs = [ZoneInfo(tz) for tz in pytz.common_timezones] File "/opt/netbox-3.2.8/venv/lib/python3.10/site-packages/timezone_field/fields.py", line 41, in <listcomp> default_zoneinfo_tzs = [ZoneInfo(tz) for tz in pytz.common_timezones] File "/usr/lib/python3.10/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 Asia/Hanoi' ` Python3 version 3.10.4 OS Ubuntu 22.04.1 LTS
adam added the type: bugstatus: accepted labels 2025-12-29 19:45:34 +01:00
adam closed this issue 2025-12-29 19:45:35 +01:00
Author
Owner

@Pelt10 commented on GitHub (Aug 12, 2022):

Same here on Debian 11.

@Pelt10 commented on GitHub (Aug 12, 2022): Same here on Debian 11.
Author
Owner

@Thulium-Drake commented on GitHub (Aug 12, 2022):

This probably means that the tzdata / zoneinfo package on your system doesn't know about the following zones (these are missing on RHEL8):

  • Asia/Hanio
  • Europe/Kyiv

You can fix this as follows:

ln -s /usr/share/zoneinfo/Etc/GMT+7 /usr/share/zoneinfo/Asia/Hanoi
ln -s /usr/share/zoneinfo/Europe/Kiev /usr/share/zoneinfo/Europe/Kyiv
@Thulium-Drake commented on GitHub (Aug 12, 2022): This probably means that the ```tzdata``` / ```zoneinfo``` package on your system doesn't know about the following zones (these are missing on RHEL8): - Asia/Hanio - Europe/Kyiv You can fix this as follows: ``` ln -s /usr/share/zoneinfo/Etc/GMT+7 /usr/share/zoneinfo/Asia/Hanoi ln -s /usr/share/zoneinfo/Europe/Kiev /usr/share/zoneinfo/Europe/Kyiv ```
Author
Owner

@Pelt10 commented on GitHub (Aug 12, 2022):

This issue seems to be a duplicate of #9985.

I'm fixing it by temporarily adding this to local_requirements.txt :

pytz==2022.1
@Pelt10 commented on GitHub (Aug 12, 2022): This issue seems to be a duplicate of #9985. I'm fixing it by temporarily adding this to local_requirements.txt : ``` pytz==2022.1 ```
Author
Owner

@saschapapini commented on GitHub (Aug 12, 2022):

I confirm with adding
pytz==2022.1
to local requirements.txt the upgrade was successful

@saschapapini commented on GitHub (Aug 12, 2022): I confirm with adding `pytz==2022.1` to local requirements.txt the upgrade was successful
Author
Owner

@candlerb commented on GitHub (Aug 12, 2022):

This probably means that the tzdata / zoneinfo package on your system doesn't know about the following zones (these are missing on RHEL8):

They are also missing from Ubuntu 20.04. Instead it has Europe/Kiev, and Asia/Ho_Chi_Minh (with Saigon as a symlink)

@candlerb commented on GitHub (Aug 12, 2022): > This probably means that the `tzdata` / `zoneinfo` package on your system doesn't know about the following zones (these are missing on RHEL8): They are also missing from Ubuntu 20.04. Instead it has `Europe/Kiev`, and `Asia/Ho_Chi_Minh` (with `Saigon` as a symlink)
Author
Owner

@jeremystretch commented on GitHub (Aug 12, 2022):

This is obviously an upstream issue, but I can't seem to even find the open bug reports for pytz. Presumably they should be here: https://bugs.launchpad.net/pytz

@jeremystretch commented on GitHub (Aug 12, 2022): This is obviously an upstream issue, but I can't seem to even find the open bug reports for pytz. Presumably they should be here: https://bugs.launchpad.net/pytz
Author
Owner

@jeremystretch commented on GitHub (Aug 12, 2022):

Found this upstream: https://github.com/stub42/pytz/issues/79

@jeremystretch commented on GitHub (Aug 12, 2022): Found this upstream: https://github.com/stub42/pytz/issues/79
Author
Owner

@Pelt10 commented on GitHub (Aug 12, 2022):

Seems to be more: https://github.com/mfogel/django-timezone-field/issues/94 ?

@Pelt10 commented on GitHub (Aug 12, 2022): Seems to be more: https://github.com/mfogel/django-timezone-field/issues/94 ?
Author
Owner

@jeremystretch commented on GitHub (Aug 12, 2022):

I just put in a PR for django-timezone-field, but I have no idea how long it will take them to cut a new release.

In the meantime, we'll pin NetBox to pytz 2022.1.

@jeremystretch commented on GitHub (Aug 12, 2022): I just put in a [PR](https://github.com/mfogel/django-timezone-field/pull/95) for `django-timezone-field`, but I have no idea how long it will take them to cut a new release. In the meantime, we'll pin NetBox to pytz 2022.1.
Author
Owner

@candlerb commented on GitHub (Aug 15, 2022):

This also begs the question of why requirements.txt was pinning a version of tzdata, but not pytz. tzdata==2022.1 has been pinned since 6f0ae8a5 (v3.2.0)

@candlerb commented on GitHub (Aug 15, 2022): This also begs the question of why requirements.txt was pinning a version of tzdata, but not pytz. `tzdata==2022.1` has been pinned since 6f0ae8a5 (v3.2.0)
Author
Owner

@jeremystretch commented on GitHub (Aug 15, 2022):

The tzdata pin was added to fix #8683. (Deja vu anyone?) It can probably be removed once a new version of django-timezone-field has been released.

@jeremystretch commented on GitHub (Aug 15, 2022): The `tzdata` pin was [added](https://github.com/netbox-community/netbox/commit/6638f560f8d18dd6e1cee4789fb3b2a5d14ff1f4) to fix #8683. (Deja vu anyone?) It can probably be removed once a new version of `django-timezone-field` has been released.
Author
Owner

@peterbaumert commented on GitHub (Aug 18, 2022):

Same happens on upgrade to 3.3.0

@peterbaumert commented on GitHub (Aug 18, 2022): Same happens on upgrade to 3.3.0
Author
Owner

@candlerb commented on GitHub (Aug 18, 2022):

Upgrade to 3.3.0 works for me. Do you have any stale entries in local_requirements.txt ?

@candlerb commented on GitHub (Aug 18, 2022): Upgrade to 3.3.0 works for me. Do you have any stale entries in `local_requirements.txt` ?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6803