[GH-ISSUE #3100] Cannot import name 'ugettext_lazy' from 'django.utils.translation' #1762

Closed
opened 2026-02-27 11:18:59 +03:00 by kerem · 3 comments
Owner

Originally created by @TheAFKGamer10 on GitHub (Oct 20, 2023).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/3100

Impacted versions

  • OS Type: Ubuntu
  • OS Version: Ubuntu 22.04.3 LTS
  • Database Type: PostgreSQL
  • Database version: psql (PostgreSQL) 14.9 (Ubuntu 14.9-0ubuntu0.22.04.1)
  • Modoboa: 2.2.2
  • installer used: Yes
  • Webserver: Nginx

Steps to reproduce

cd /srv/modoboa/instance
pip install modoboa==2.2.2
python manage.py migrate

Current behavior

Error gets thrown, I googled the subject and it says that ugettext_lazy is not supported anymore. It occured during python3 manage.py migrate command.

Traceback (most recent call last):
  File "/srv/modoboa/instance/manage.py", line 22, in <module>
    main()
  File "/srv/modoboa/instance/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/__init__.py", line 416, in execute
    django.setup()
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/apps/registry.py", line 116, in populate
    app_config.import_models()
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/apps/config.py", line 269, in import_models
    self.models_module = import_module(models_module_name)
  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 "/srv/modoboa/env/lib/python3.10/site-packages/modoboa_amavis/models.py", line 16, in <module>
    from django.utils.translation import ugettext_lazy
ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation' (/srv/modoboa/env/lib/python3.10/site-packages/django/utils/translation/__init__.py)

Expected behavior

Update is sucessful and updates to the lattest version.

Originally created by @TheAFKGamer10 on GitHub (Oct 20, 2023). Original GitHub issue: https://github.com/modoboa/modoboa/issues/3100 # Impacted versions * OS Type: Ubuntu * OS Version: Ubuntu 22.04.3 LTS * Database Type: PostgreSQL * Database version: psql (PostgreSQL) 14.9 (Ubuntu 14.9-0ubuntu0.22.04.1) * Modoboa: 2.2.2 * installer used: Yes * Webserver: Nginx # Steps to reproduce ``` cd /srv/modoboa/instance pip install modoboa==2.2.2 python manage.py migrate ``` # Current behavior Error gets thrown, I googled the subject and it says that `ugettext_lazy` is not supported anymore. It occured during `python3 manage.py migrate` command. ``` Traceback (most recent call last): File "/srv/modoboa/instance/manage.py", line 22, in <module> main() File "/srv/modoboa/instance/manage.py", line 18, in main execute_from_command_line(sys.argv) File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/management/__init__.py", line 416, in execute django.setup() File "/srv/modoboa/env/lib/python3.10/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/srv/modoboa/env/lib/python3.10/site-packages/django/apps/registry.py", line 116, in populate app_config.import_models() File "/srv/modoboa/env/lib/python3.10/site-packages/django/apps/config.py", line 269, in import_models self.models_module = import_module(models_module_name) 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 "/srv/modoboa/env/lib/python3.10/site-packages/modoboa_amavis/models.py", line 16, in <module> from django.utils.translation import ugettext_lazy ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation' (/srv/modoboa/env/lib/python3.10/site-packages/django/utils/translation/__init__.py) ``` # Expected behavior Update is sucessful and updates to the lattest version.
kerem closed this issue 2026-02-27 11:18:59 +03:00
Author
Owner

@tonioo commented on GitHub (Oct 21, 2023):

It's clearly mentioned in the upgrade instructions that you also need to update extensions.
https://modoboa.readthedocs.io/en/latest/upgrade.html#id2

<!-- gh-comment-id:1773842390 --> @tonioo commented on GitHub (Oct 21, 2023): It's clearly mentioned in the upgrade instructions that you also need to update extensions. https://modoboa.readthedocs.io/en/latest/upgrade.html#id2
Author
Owner

@blloyd75 commented on GitHub (Nov 5, 2023):

I found this CLOSED error because I was searching for why i have so many errors.
I have modoboa_pdfcredentials 1.5.0, which is reporting as the newest version of that extension. And I still see the error thrown from modoboa_pdfcredentials.

<!-- gh-comment-id:1793842100 --> @blloyd75 commented on GitHub (Nov 5, 2023): I found this CLOSED error because I was searching for why i have so many errors. I have modoboa_pdfcredentials 1.5.0, which is reporting as the newest version of that extension. And I still see the error thrown from modoboa_pdfcredentials.
Author
Owner

@tonioo commented on GitHub (Nov 7, 2023):

@blloyd75 Looks like you missed some upgrade steps:
https://modoboa.readthedocs.io/en/latest/upgrade.html#id3

<!-- gh-comment-id:1798004749 --> @tonioo commented on GitHub (Nov 7, 2023): @blloyd75 Looks like you missed some upgrade steps: https://modoboa.readthedocs.io/en/latest/upgrade.html#id3
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#1762
No description provided.