cannot import name 'ugettext_lazy' from 'django.utils.translation'

Bug #2039226 reported by Corey Bryant
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Magnum UI
New
Undecided
Unassigned
OpenStack Dashboard Charm
In Progress
High
Unassigned
Ubuntu Cloud Archive
Status tracked in Bobcat
Bobcat
Triaged
High
Unassigned
watcher-dashboard
New
Undecided
Unassigned
magnum-ui (Ubuntu)
Status tracked in Mantic
Mantic
Triaged
High
Unassigned
watcher-dashboard (Ubuntu)
Status tracked in Mantic
Mantic
Fix Released
Undecided
Unassigned

Bug Description

On Ubuntu Mantic, the dashboard fails to load and the apache error log shows:

[Thu Oct 12 20:33:48.383727 2023] [wsgi:error] [pid 52899:tid 140293563209408] ERROR:root:cannot import name 'ugettext_lazy' from 'django.utils.translation' (/usr/lib/python3/dist-packages/django/utils/translation/__init__.py)
[Thu Oct 12 20:33:48.383757 2023] [wsgi:error] [pid 52899:tid 140293563209408] Traceback (most recent call last):
[Thu Oct 12 20:33:48.383764 2023] [wsgi:error] [pid 52899:tid 140293563209408] File "/usr/lib/python3/dist-packages/openstack_dashboard/utils/settings.py", line 58, in import_submodules
[Thu Oct 12 20:33:48.383769 2023] [wsgi:error] [pid 52899:tid 140293563209408] submodule = import_module(name)
[Thu Oct 12 20:33:48.383773 2023] [wsgi:error] [pid 52899:tid 140293563209408] ^^^^^^^^^^^^^^^^^^^
[Thu Oct 12 20:33:48.383777 2023] [wsgi:error] [pid 52899:tid 140293563209408] File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
[Thu Oct 12 20:33:48.383787 2023] [wsgi:error] [pid 52899:tid 140293563209408] return _bootstrap._gcd_import(name[level:], package, level)
[Thu Oct 12 20:33:48.383791 2023] [wsgi:error] [pid 52899:tid 140293563209408] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[Thu Oct 12 20:33:48.383795 2023] [wsgi:error] [pid 52899:tid 140293563209408] File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
[Thu Oct 12 20:33:48.383799 2023] [wsgi:error] [pid 52899:tid 140293563209408] File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
[Thu Oct 12 20:33:48.383803 2023] [wsgi:error] [pid 52899:tid 140293563209408] File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
[Thu Oct 12 20:33:48.383807 2023] [wsgi:error] [pid 52899:tid 140293563209408] File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
[Thu Oct 12 20:33:48.383811 2023] [wsgi:error] [pid 52899:tid 140293563209408] File "<frozen importlib._bootstrap_external>", line 940, in exec_module
[Thu Oct 12 20:33:48.383814 2023] [wsgi:error] [pid 52899:tid 140293563209408] File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
[Thu Oct 12 20:33:48.383818 2023] [wsgi:error] [pid 52899:tid 140293563209408] File "/usr/lib/python3/dist-packages/openstack_dashboard/enabled/_1370_project_container_infra_panel_group.py", line 14, in <module>
[Thu Oct 12 20:33:48.383823 2023] [wsgi:error] [pid 52899:tid 140293563209408] from django.utils.translation import ugettext_lazy as _

It looks like the charm template needs updating to work with Django 4.x in Mantic.

See upstream commit in horizon:

commit cd7c1b5110fe1f64cd9dfbeb1072b37912d0efee
Author: Akihiro Motoki <email address hidden>
Date: Wed Jan 26 22:42:15 2022 +0900

    Address RemovedInDjango40Warning (2)

    django.utils.translation.ugettext(), ugettext_lazy(), ugettext_noop(),
    ungettext(), and ungettext_lazy() are deprecated in favor of the
    functions that they’re aliases for: django.utils.translation.gettext(),
    gettext_lazy(), gettext_noop(), ngettext(), and ngettext_lazy().

    https://docs.djangoproject.com/en/4.0/releases/3.0/#id3

    Change-Id: I77878f84e9d10cf6a136dada81eabf4e18676250

Revision history for this message
Corey Bryant (corey.bryant) wrote :
Changed in watcher-dashboard (Ubuntu Mantic):
status: New → Fix Released
Revision history for this message
Corey Bryant (corey.bryant) wrote :
Revision history for this message
Corey Bryant (corey.bryant) wrote :
Download full text (7.7 KiB)

SRU details for magnum-ui

[Impact]

magnum dashboard can't be used with Django 4.x. See /var/log/apache/error.log:

[Thu Oct 12 21:11:53.240437 2023] [wsgi:error] [pid 71732:tid 140109883819712] [remote 10.5.3.66:56488] Could not import panel module magnum_ui.content.clusters.panel: cannot import name 'ugettext_lazy' from 'django.utils.translation' (/usr/lib/python3/dist-packages/django/utils/translation/__init__.py)
[Thu Oct 12 21:11:53.241129 2023] [wsgi:error] [pid 71732:tid 140109883819712] [remote 10.5.3.66:56488] Could not import panel module magnum_ui.content.cluster_templates.panel: cannot import name 'ugettext_lazy' from 'django.utils.translation' (/usr/lib/python3/dist-packages/django/utils/translation/__init__.py)
[Thu Oct 12 21:11:53.262688 2023] [wsgi:error] [pid 71732:tid 140109883819712] [remote 10.5.3.66:56488] Could not import panel module magnum_ui.content.container_infra.quotas.panel: cannot import name 'ugettext_lazy' from 'django.utils.translation' (/usr/lib/python3/dist-packages/django/utils/translation/__init__.py)
[Thu Oct 12 21:11:54.987658 2023] [wsgi:error] [pid 71733:tid 140109883819712] /usr/lib/python3/dist-packages/django/conf/__init__.py:267: RemovedInDjango50Warning: The USE_L10N setting is deprecated. Starting with Django 5.0, localized formatting of data will always be enabled. For example Django will display numbers and dates using the format of the current locale.
[Thu Oct 12 21:11:54.987699 2023] [wsgi:error] [pid 71733:tid 140109883819712] warnings.warn(USE_L10N_DEPRECATED_MSG, RemovedInDjango50Warning)
[Thu Oct 12 21:11:55.009599 2023] [wsgi:error] [pid 71733:tid 140109883819712] WARNING:root:Error importing openstack_dashboard.enabled._1370_project_container_infra_panel_group
[Thu Oct 12 21:11:55.011170 2023] [wsgi:error] [pid 71733:tid 140109883819712] ERROR:root:cannot import name 'ugettext_lazy' from 'django.utils.translation' (/usr/lib/python3/dist-packages/django/utils/translation/__init__.py)
[Thu Oct 12 21:11:55.011232 2023] [wsgi:error] [pid 71733:tid 140109883819712] Traceback (most recent call last):
[Thu Oct 12 21:11:55.011241 2023] [wsgi:error] [pid 71733:tid 140109883819712] File "/usr/lib/python3/dist-packages/openstack_dashboard/utils/settings.py", line 58, in import_submodules
[Thu Oct 12 21:11:55.011247 2023] [wsgi:error] [pid 71733:tid 140109883819712] submodule = import_module(name)
[Thu Oct 12 21:11:55.011253 2023] [wsgi:error] [pid 71733:tid 140109883819712] ^^^^^^^^^^^^^^^^^^^
[Thu Oct 12 21:11:55.011259 2023] [wsgi:error] [pid 71733:tid 140109883819712] File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
[Thu Oct 12 21:11:55.011265 2023] [wsgi:error] [pid 71733:tid 140109883819712] return _bootstrap._gcd_import(name[level:], package, level)
[Thu Oct 12 21:11:55.011271 2023] [wsgi:error] [pid 71733:tid 140109883819712] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[Thu Oct 12 21:11:55.011277 2023] [wsgi:error] [pid 71733:tid 140109883819712] File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
[Thu Oct 12 21:11:55.011283 2023] [wsgi:error] [pid 71733:tid 140109883819712] File "<frozen importli...

Read more...

Changed in magnum-ui (Ubuntu Mantic):
status: New → Triaged
importance: Undecided → High
Revision history for this message
Corey Bryant (corey.bryant) wrote :

If magnum-ui fix is needed before SRU lands, it is available in https://launchpad.net/~corey.bryant/+archive/ubuntu/mantic-bobcat

Changed in charm-openstack-dashboard:
status: New → Triaged
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-openstack-dashboard (master)
Changed in charm-openstack-dashboard:
status: Triaged → In Progress
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.