[BUG] cyberpanel cli 2.3.4 @ Django 4.1.1 on Ubuntu throws error ImportError : cannot import name 'ugettext_lazy'
Describe the bug
Executing cyberpanel on cli throws this error:
(CyberCP) root@idcub1-54:/usr/local/CyberCP# cyberpanel -h
Traceback (most recent call last):
File "/usr/bin/cyberpanel", line 8, in <module>
django.setup()
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/__init__.py", line 19, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/conf/__init__.py", line 92, in __getattr__
self._setup(name)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/conf/__init__.py", line 79, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/CyberCP/lib/python3.10/site-packages/django/conf/__init__.py", line 190, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
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 "/usr/local/CyberCP/CyberCP/settings.py", line 14, in <module>
from django.utils.translation import ugettext_lazy as _
ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation' (/usr/local/CyberCP/lib/python3.10/site-packages/django/utils/translation/__init__.py)
(CyberCP) root@idcub1-54:/usr/local/CyberCP# cyberpanel help
- version
(CyberCP) root@idcub1-54:/usr/local/CyberCP# cat version.txt
2.3
4(CyberCP) root@idcub1-54:/usr/local/CyberCP#
Directly looking at the error at S.O., django generated code throws such an error
- https://stackoverflow.com/questions/70656495/importerror-cannot-import-name-ugettext-lazy
Fixing this directly by changing ugettext_lazy to gettext_lazy seems to solve the problem. I don't know if this a django bug or a cyberpanel bug.
To Reproduce What steps did you take when the issue occurred?
- Install and use cyberpanel 2.3.4 @ ubuntu 22.04
- run
cyberpanelcommand
Expected behavior
No error thrown after the installation. We shouldn't need to edit the generated settings.py manually.
Operating system: Ubuntu 22.04 LTS
CyberPanel version: 2.3.4
Additional context If there is anything else that you'd like us to know about this issue that will help us diagnose and troubleshoot more effectively, such as links to forum posts or other discussions, please feel free to share here.
Did you manually upgrade django to 4.1.1 ?
@usmannasir No, all the installation files are original from the repo. It is also stated here btw
https://github.com/usmannasir/cyberpanel/blob/stable/ubuntu-requirments.txt
Currently, i switched to ubuntu 20.04 and the problem seems to not exist.
These ones are used: https://github.com/usmannasir/cyberpanel/blob/stable/requirments.txt
How do you install 4.1.1 ?