[GH-ISSUE #2553] Migrate from 1.17 to 2.01 error #1632

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

Originally created by @studioluminous on GitHub (Jun 28, 2022).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/2553

Impacted versions

  • OS Type: Ubuntu
  • OS Version: 18.04 LTs
  • Database Type: MariaDB
  • Database version: X.y
  • Modoboa: 2.0.1
  • installer used: Unknown
  • Webserver: Nginx

Current behavior

I just tried upgrading modoboa to 2.0.1 from 1.17. I was able to succesfully upgrade the modules via cli, did the migrate/static/deploy. I did have to reinstall all the modules after updating python from 3.6 to 3.9 but after doing that I was able to migrate and deploy.

I'm getting the warning as follows from all the modoboa related users cron.

/srv/modoboa/env/lib/python3.9/site-packages/requests/init.py:109: RequestsDependencyWarning: urllib3 (1.21.1) or chardet (5.0.0)/charset_normalizer (2.0.12) doesn't match a supported version!
warnings.warn(

I've tried changing versions of urllib3 to no avail. All come back with the same error.

Here's the debug:

Environment:

Request Method: GET
Request URL: https://my.server.com

Django Version: 2.2.12
Python Version: 3.6.9
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.sites',
'django.contrib.staticfiles',
'reversion',
'ckeditor',
'ckeditor_uploader',
'rest_framework',
'rest_framework.authtoken',
'django_otp',
'django_otp.plugins.otp_totp',
'django_otp.plugins.otp_static',
'modoboa',
'modoboa.core',
'modoboa.lib',
'modoboa.admin',
'modoboa.transport',
'modoboa.relaydomains',
'modoboa.limits',
'modoboa.parameters',
'modoboa.dnstools',
'modoboa.maillog',
'modoboa_amavis',
'modoboa_pdfcredentials',
'modoboa_postfix_autoreply',
'modoboa_sievefilters',
'modoboa_webmail',
'modoboa_contacts',
'modoboa_radicale',
'webpack_loader')
Installed Middleware:
('x_forwarded_for.middleware.XForwardedForMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django_otp.middleware.OTPMiddleware',
'modoboa.core.middleware.TwoFAMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'modoboa.core.middleware.LocalConfigMiddleware',
'modoboa.lib.middleware.AjaxLoginRedirect',
'modoboa.lib.middleware.CommonExceptionCatcher',
'modoboa.lib.middleware.RequestCatcherMiddleware')

Traceback:

File "/srv/modoboa/env/lib/python3.6/site-packages/rest_framework/settings.py" in import_from_string
177. return import_string(val)

File "/srv/modoboa/env/lib/python3.6/site-packages/django/utils/module_loading.py" in import_string
17. module = import_module(module_path)

File "/usr/lib/python3.6/importlib/init.py" in import_module
126. return _bootstrap._gcd_import(name[level:], package, level)

File "" in _gcd_import
994.

File "" in _find_and_load
971.

File "" in _find_and_load_unlocked
953.

During handling of the above exception (No module named 'modoboa.core.drf_authentication'), another exception occurred:

File "/srv/modoboa/env/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
34. response = get_response(request)

File "/srv/modoboa/env/lib/python3.6/site-packages/modoboa/core/middleware.py" in call
26. redirect_url = reverse("core:2fa_verify")

File "/srv/modoboa/env/lib/python3.6/site-packages/django/urls/base.py" in reverse
58. app_list = resolver.app_dict[ns]

File "/srv/modoboa/env/lib/python3.6/site-packages/django/urls/resolvers.py" in app_dict
513. self._populate()

File "/srv/modoboa/env/lib/python3.6/site-packages/django/urls/resolvers.py" in _populate
447. for url_pattern in reversed(self.url_patterns):

File "/srv/modoboa/env/lib/python3.6/site-packages/django/utils/functional.py" in get
80. res = instance.dict[self.name] = self.func(instance)

File "/srv/modoboa/env/lib/python3.6/site-packages/django/urls/resolvers.py" in url_patterns
584. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)

File "/srv/modoboa/env/lib/python3.6/site-packages/django/utils/functional.py" in get
80. res = instance.dict[self.name] = self.func(instance)

File "/srv/modoboa/env/lib/python3.6/site-packages/django/urls/resolvers.py" in urlconf_module
577. return import_module(self.urlconf_name)

File "/usr/lib/python3.6/importlib/init.py" in import_module
126. return _bootstrap._gcd_import(name[level:], package, level)

File "" in _gcd_import
994.

File "" in _find_and_load
971.

File "" in _find_and_load_unlocked
955.

File "" in _load_unlocked
665.

File "" in exec_module
678.

File "" in _call_with_frames_removed
219.

File "./instance/urls.py" in
4. url(r'', include('modoboa.urls')),

File "/srv/modoboa/env/lib/python3.6/site-packages/django/urls/conf.py" in include
34. urlconf_module = import_module(urlconf_module)

File "/usr/lib/python3.6/importlib/init.py" in import_module
126. return _bootstrap._gcd_import(name[level:], package, level)

File "" in _gcd_import
994.

File "" in _find_and_load
971.

File "" in _find_and_load_unlocked
955.

File "" in _load_unlocked
665.

File "" in exec_module
678.

File "" in _call_with_frames_removed
219.

File "/srv/modoboa/env/lib/python3.6/site-packages/modoboa/urls.py" in
13. from rest_framework.schemas import get_schema_view

File "/srv/modoboa/env/lib/python3.6/site-packages/rest_framework/schemas/init.py" in
33. authentication_classes=api_settings.DEFAULT_AUTHENTICATION_CLASSES,

File "/srv/modoboa/env/lib/python3.6/site-packages/rest_framework/settings.py" in getattr
220. val = perform_import(val, attr)

File "/srv/modoboa/env/lib/python3.6/site-packages/rest_framework/settings.py" in perform_import
168. return [import_from_string(item, setting_name) for item in val]

File "/srv/modoboa/env/lib/python3.6/site-packages/rest_framework/settings.py" in
168. return [import_from_string(item, setting_name) for item in val]

File "/srv/modoboa/env/lib/python3.6/site-packages/rest_framework/settings.py" in import_from_string
180. raise ImportError(msg)

Exception Type: ImportError at /
Exception Value: Could not import 'modoboa.core.drf_authentication.JWTAuthenticationWith2FA' for API setting 'DEFAULT_AUTHENTICATION_CLASSES'. ModuleNotFoundError: No module named 'modoboa.core.drf_authentication'.

Originally created by @studioluminous on GitHub (Jun 28, 2022). Original GitHub issue: https://github.com/modoboa/modoboa/issues/2553 # Impacted versions * OS Type: Ubuntu * OS Version: 18.04 LTs * Database Type: MariaDB * Database version: X.y * Modoboa: 2.0.1 * installer used: Unknown * Webserver: Nginx # Current behavior I just tried upgrading modoboa to 2.0.1 from 1.17. I was able to succesfully upgrade the modules via cli, did the migrate/static/deploy. I did have to reinstall all the modules after updating python from 3.6 to 3.9 but after doing that I was able to migrate and deploy. I'm getting the warning as follows from all the modoboa related users cron. /srv/modoboa/env/lib/python3.9/site-packages/requests/__init__.py:109: RequestsDependencyWarning: urllib3 (1.21.1) or chardet (5.0.0)/charset_normalizer (2.0.12) doesn't match a supported version! warnings.warn( I've tried changing versions of urllib3 to no avail. All come back with the same error. Here's the debug: Environment: Request Method: GET Request URL: https://my.server.com Django Version: 2.2.12 Python Version: 3.6.9 Installed Applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.sites', 'django.contrib.staticfiles', 'reversion', 'ckeditor', 'ckeditor_uploader', 'rest_framework', 'rest_framework.authtoken', 'django_otp', 'django_otp.plugins.otp_totp', 'django_otp.plugins.otp_static', 'modoboa', 'modoboa.core', 'modoboa.lib', 'modoboa.admin', 'modoboa.transport', 'modoboa.relaydomains', 'modoboa.limits', 'modoboa.parameters', 'modoboa.dnstools', 'modoboa.maillog', 'modoboa_amavis', 'modoboa_pdfcredentials', 'modoboa_postfix_autoreply', 'modoboa_sievefilters', 'modoboa_webmail', 'modoboa_contacts', 'modoboa_radicale', 'webpack_loader') Installed Middleware: ('x_forwarded_for.middleware.XForwardedForMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django_otp.middleware.OTPMiddleware', 'modoboa.core.middleware.TwoFAMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'modoboa.core.middleware.LocalConfigMiddleware', 'modoboa.lib.middleware.AjaxLoginRedirect', 'modoboa.lib.middleware.CommonExceptionCatcher', 'modoboa.lib.middleware.RequestCatcherMiddleware') Traceback: File "/srv/modoboa/env/lib/python3.6/site-packages/rest_framework/settings.py" in import_from_string 177. return import_string(val) File "/srv/modoboa/env/lib/python3.6/site-packages/django/utils/module_loading.py" in import_string 17. module = import_module(module_path) File "/usr/lib/python3.6/importlib/__init__.py" in import_module 126. return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>" in _gcd_import 994. <source code not available> File "<frozen importlib._bootstrap>" in _find_and_load 971. <source code not available> File "<frozen importlib._bootstrap>" in _find_and_load_unlocked 953. <source code not available> During handling of the above exception (No module named 'modoboa.core.drf_authentication'), another exception occurred: File "/srv/modoboa/env/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner 34. response = get_response(request) File "/srv/modoboa/env/lib/python3.6/site-packages/modoboa/core/middleware.py" in __call__ 26. redirect_url = reverse("core:2fa_verify") File "/srv/modoboa/env/lib/python3.6/site-packages/django/urls/base.py" in reverse 58. app_list = resolver.app_dict[ns] File "/srv/modoboa/env/lib/python3.6/site-packages/django/urls/resolvers.py" in app_dict 513. self._populate() File "/srv/modoboa/env/lib/python3.6/site-packages/django/urls/resolvers.py" in _populate 447. for url_pattern in reversed(self.url_patterns): File "/srv/modoboa/env/lib/python3.6/site-packages/django/utils/functional.py" in __get__ 80. res = instance.__dict__[self.name] = self.func(instance) File "/srv/modoboa/env/lib/python3.6/site-packages/django/urls/resolvers.py" in url_patterns 584. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/srv/modoboa/env/lib/python3.6/site-packages/django/utils/functional.py" in __get__ 80. res = instance.__dict__[self.name] = self.func(instance) File "/srv/modoboa/env/lib/python3.6/site-packages/django/urls/resolvers.py" in urlconf_module 577. return import_module(self.urlconf_name) File "/usr/lib/python3.6/importlib/__init__.py" in import_module 126. return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>" in _gcd_import 994. <source code not available> File "<frozen importlib._bootstrap>" in _find_and_load 971. <source code not available> File "<frozen importlib._bootstrap>" in _find_and_load_unlocked 955. <source code not available> File "<frozen importlib._bootstrap>" in _load_unlocked 665. <source code not available> File "<frozen importlib._bootstrap_external>" in exec_module 678. <source code not available> File "<frozen importlib._bootstrap>" in _call_with_frames_removed 219. <source code not available> File "./instance/urls.py" in <module> 4. url(r'', include('modoboa.urls')), File "/srv/modoboa/env/lib/python3.6/site-packages/django/urls/conf.py" in include 34. urlconf_module = import_module(urlconf_module) File "/usr/lib/python3.6/importlib/__init__.py" in import_module 126. return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>" in _gcd_import 994. <source code not available> File "<frozen importlib._bootstrap>" in _find_and_load 971. <source code not available> File "<frozen importlib._bootstrap>" in _find_and_load_unlocked 955. <source code not available> File "<frozen importlib._bootstrap>" in _load_unlocked 665. <source code not available> File "<frozen importlib._bootstrap_external>" in exec_module 678. <source code not available> File "<frozen importlib._bootstrap>" in _call_with_frames_removed 219. <source code not available> File "/srv/modoboa/env/lib/python3.6/site-packages/modoboa/urls.py" in <module> 13. from rest_framework.schemas import get_schema_view File "/srv/modoboa/env/lib/python3.6/site-packages/rest_framework/schemas/__init__.py" in <module> 33. authentication_classes=api_settings.DEFAULT_AUTHENTICATION_CLASSES, File "/srv/modoboa/env/lib/python3.6/site-packages/rest_framework/settings.py" in __getattr__ 220. val = perform_import(val, attr) File "/srv/modoboa/env/lib/python3.6/site-packages/rest_framework/settings.py" in perform_import 168. return [import_from_string(item, setting_name) for item in val] File "/srv/modoboa/env/lib/python3.6/site-packages/rest_framework/settings.py" in <listcomp> 168. return [import_from_string(item, setting_name) for item in val] File "/srv/modoboa/env/lib/python3.6/site-packages/rest_framework/settings.py" in import_from_string 180. raise ImportError(msg) Exception Type: ImportError at / Exception Value: Could not import 'modoboa.core.drf_authentication.JWTAuthenticationWith2FA' for API setting 'DEFAULT_AUTHENTICATION_CLASSES'. ModuleNotFoundError: No module named 'modoboa.core.drf_authentication'.
kerem closed this issue 2026-02-27 11:18:14 +03:00
Author
Owner

@studioluminous commented on GitHub (Jun 28, 2022):

I was able to get in to the web interface and eliminate the debug error by commenting out the rest framework in the settings.py. Even though I've upgraded modoboa and all the modules, on the modoboa web interface it's showing they are all at the old versions.
Screen Shot 2022-06-28 at 9 37 03 AM

<!-- gh-comment-id:1168965321 --> @studioluminous commented on GitHub (Jun 28, 2022): I was able to get in to the web interface and eliminate the debug error by commenting out the rest framework in the settings.py. Even though I've upgraded modoboa and all the modules, on the modoboa web interface it's showing they are all at the old versions. <img width="1723" alt="Screen Shot 2022-06-28 at 9 37 03 AM" src="https://user-images.githubusercontent.com/28231387/176234557-581817f4-28d4-4a6e-989e-ef2388424ac5.png">
Author
Owner

@tonioo commented on GitHub (Jun 28, 2022):

@studioluminous Modoboa 2+ requires python 3.7 at least, I can see that you're using 3.6 so it won't work.

<!-- gh-comment-id:1168978027 --> @tonioo commented on GitHub (Jun 28, 2022): @studioluminous Modoboa 2+ requires python 3.7 at least, I can see that you're using 3.6 so it won't work.
Author
Owner

@studioluminous commented on GitHub (Jun 28, 2022):

My apologies but I'm using python 3.9 as I mentioned. I see that the traceback says 3.6 but as the error says, it's coming from the 3.9 version of python in the virtualenv path.

/srv/modoboa/env/lib/python3.9/site-packages/requests/init.py:109: RequestsDependencyWarning: urllib3 (1.21.1) or chardet (5.0.0)/charset_normalizer (2.0.12) doesn't match a supported version!

<!-- gh-comment-id:1169002656 --> @studioluminous commented on GitHub (Jun 28, 2022): My apologies but I'm using python 3.9 as I mentioned. I see that the traceback says 3.6 but as the error says, it's coming from the 3.9 version of python in the virtualenv path. /srv/modoboa/env/lib/python3.9/site-packages/requests/__init__.py:109: RequestsDependencyWarning: urllib3 (1.21.1) or chardet (5.0.0)/charset_normalizer (2.0.12) doesn't match a supported version!
Author
Owner

@tonioo commented on GitHub (Jun 29, 2022):

If you're seeing 3.6 in you path, then it means your virtualenv is broken in some way. You should not see any other version than 3.9

<!-- gh-comment-id:1169634764 --> @tonioo commented on GitHub (Jun 29, 2022): If you're seeing 3.6 in you path, then it means your virtualenv is broken in some way. You should not see any other version than 3.9
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#1632
No description provided.