[GH-ISSUE #2666] Error in modoboa-instance.log and server not starting after upgrade to modoboa 2.0.3 #1672

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

Originally created by @antoweb on GitHub (Nov 2, 2022).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/2666

Impacted versions

  • OS Type: 20.04.4 LTS (Focal Fossa)
  • OS Version: 20.0.4
  • Database Type: PostgreSQL
  • Database version: postgres (PostgreSQL) 12.12
  • Modoboa: 2.0.2
  • installer used: Yes but upgradated from pip
  • Webserver: Nginx

Steps to reproduce

Current behavior

Error starting modoboa:
Wed Nov 2 08:38:40 2022 - *** Operational MODE: preforking ***
Traceback (most recent call last):
File "/srv/modoboa/instance/./instance/wsgi.py", line 16, in
application = get_wsgi_application()
File "/srv/modoboa/env/lib/python3.8/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "/srv/modoboa/env/lib/python3.8/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/srv/modoboa/env/lib/python3.8/site-packages/django/apps/registry.py", line 92, in populate
app_config = AppConfig.create(entry)
File "/srv/modoboa/env/lib/python3.8/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'drf-spectacular'

module drf-spectacular is correctly installed version 0.25:
postgres@mail:~$ pip show drf-spectacular
Name: drf-spectacular
Version: 0.24.2
Summary: Sane and flexible OpenAPI 3 schema generation for Django REST framework
Home-page: https://github.com/tfranzel/drf-spectacular
Author: T. Franzel
Author-email: tfranzel@gmail.com
License: BSD
Location: /usr/local/lib/python3.8/dist-packages
Requires: Django, djangorestframework, inflection, jsonschema, PyYAML, uritemplate

settings.py:
INSTALLED_APPS = (
'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',
'drf_spectacular',
'phonenumber_field',
'django_otp',
'django_otp.plugins.otp_totp',
'django_otp.plugins.otp_static',

)

Expected behavior

Video/Screenshot link (optional)

Originally created by @antoweb on GitHub (Nov 2, 2022). Original GitHub issue: https://github.com/modoboa/modoboa/issues/2666 # Impacted versions * OS Type: 20.04.4 LTS (Focal Fossa) * OS Version: 20.0.4 * Database Type: PostgreSQL * Database version: postgres (PostgreSQL) 12.12 * Modoboa: 2.0.2 * installer used: Yes but upgradated from pip * Webserver: Nginx # Steps to reproduce # Current behavior Error starting modoboa: Wed Nov 2 08:38:40 2022 - *** Operational MODE: preforking *** Traceback (most recent call last): File "/srv/modoboa/instance/./instance/wsgi.py", line 16, in <module> application = get_wsgi_application() File "/srv/modoboa/env/lib/python3.8/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application django.setup(set_prefix=False) File "/srv/modoboa/env/lib/python3.8/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/srv/modoboa/env/lib/python3.8/site-packages/django/apps/registry.py", line 92, in populate app_config = AppConfig.create(entry) File "/srv/modoboa/env/lib/python3.8/site-packages/django/apps/config.py", line 90, in create module = import_module(entry) File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ModuleNotFoundError: No module named 'drf-spectacular' module drf-spectacular is correctly installed version 0.25: postgres@mail:~$ pip show drf-spectacular Name: drf-spectacular Version: 0.24.2 Summary: Sane and flexible OpenAPI 3 schema generation for Django REST framework Home-page: https://github.com/tfranzel/drf-spectacular Author: T. Franzel Author-email: tfranzel@gmail.com License: BSD Location: /usr/local/lib/python3.8/dist-packages Requires: Django, djangorestframework, inflection, jsonschema, PyYAML, uritemplate settings.py: INSTALLED_APPS = ( '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', 'drf_spectacular', 'phonenumber_field', 'django_otp', 'django_otp.plugins.otp_totp', 'django_otp.plugins.otp_static', ) # Expected behavior # Video/Screenshot link (optional)
kerem closed this issue 2026-02-27 11:18:30 +03:00
Author
Owner

@Spitfireap commented on GitHub (Nov 2, 2022):

Hi,

/usr/local/lib/python3.8/dist-packages

It seems you have drf-spectacular installed as global package. If your venv was built before you installed it, it will not be in modoboa's venv.

To fix it : /srv/modoboa/env/bin/pip install drf-spectacular

<!-- gh-comment-id:1299729760 --> @Spitfireap commented on GitHub (Nov 2, 2022): Hi, > /usr/local/lib/python3.8/dist-packages It seems you have drf-spectacular installed as global package. If your venv was built before you installed it, it will not be in modoboa's venv. To fix it : ``/srv/modoboa/env/bin/pip install drf-spectacular``
Author
Owner

@antoweb commented on GitHub (Nov 2, 2022):

Ok thanks but now i have another error

ImportError: Could not import 'modoboa.core.drf_authentication.JWTAuthenticationWith2FA' for API setting 'DEFAULT_AUTHENTICATION_CLASSES'. ModuleNotFoundError: No module named 'modoboa.core.drf_authentication'.
143.47.186.33:8080 [pid: 9568|app: 1|req: 2/2] 82.54.222.231 () {58 vars in 1055 bytes} [Wed Nov 2 09:04:40 2022] GET /favicon.ico => generated 0 bytes in 40 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)

<!-- gh-comment-id:1299753222 --> @antoweb commented on GitHub (Nov 2, 2022): Ok thanks but now i have another error ImportError: Could not import 'modoboa.core.drf_authentication.JWTAuthenticationWith2FA' for API setting 'DEFAULT_AUTHENTICATION_CLASSES'. ModuleNotFoundError: No module named 'modoboa.core.drf_authentication'. 143.47.186.33:8080 [pid: 9568|app: 1|req: 2/2] 82.54.222.231 () {58 vars in 1055 bytes} [Wed Nov 2 09:04:40 2022] GET /favicon.ico => generated 0 bytes in 40 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)
Author
Owner

@Spitfireap commented on GitHub (Nov 2, 2022):

Please follow this guide. Start from the version you come from up to 2.0.3. You're missing some manual changes, I believe :)

<!-- gh-comment-id:1299759493 --> @Spitfireap commented on GitHub (Nov 2, 2022): Please follow [this guide](https://modoboa.readthedocs.io/en/latest/upgrade.html#id3). Start from the version you come from up to `2.0.3`. You're missing some manual changes, I believe :)
Author
Owner

@antoweb commented on GitHub (Nov 2, 2022):

Hello ia have made all manual change required. maybe i missing this module?
ModuleNotFoundError: No module named 'modoboa.core.drf_authentication'

<!-- gh-comment-id:1299771388 --> @antoweb commented on GitHub (Nov 2, 2022): Hello ia have made all manual change required. maybe i missing this module? ModuleNotFoundError: No module named 'modoboa.core.drf_authentication'
Author
Owner

@Spitfireap commented on GitHub (Nov 2, 2022):

Could you post the output of /srv/modoboa/env/bin/pip list | grep modoboa please ?

<!-- gh-comment-id:1299786115 --> @Spitfireap commented on GitHub (Nov 2, 2022): Could you post the output of ``/srv/modoboa/env/bin/pip list | grep modoboa`` please ?
Author
Owner

@antoweb commented on GitHub (Nov 2, 2022):

root@mail:/home/ubuntu# /srv/modoboa/env/bin/pip list | grep modoboa
modoboa 1.17.0
modoboa-amavis 1.3.1
modoboa-contacts 0.8.2
modoboa-pdfcredentials 1.4.0
modoboa-postfix-autoreply 1.6.1
modoboa-radicale 1.5.1
modoboa-sievefilters 1.5.0
modoboa-webmail 1.6.1

<!-- gh-comment-id:1299796246 --> @antoweb commented on GitHub (Nov 2, 2022): root@mail:/home/ubuntu# /srv/modoboa/env/bin/pip list | grep modoboa modoboa 1.17.0 modoboa-amavis 1.3.1 modoboa-contacts 0.8.2 modoboa-pdfcredentials 1.4.0 modoboa-postfix-autoreply 1.6.1 modoboa-radicale 1.5.1 modoboa-sievefilters 1.5.0 modoboa-webmail 1.6.1
Author
Owner

@Spitfireap commented on GitHub (Nov 2, 2022):

okay, so it seems you updated everything outside your venv. Please update it with your venv :

source /srv/modoboa/env/bin/activate

then update modoboa with pip as you did and reapply changes in the guide where the line starts with (env).

<!-- gh-comment-id:1299803858 --> @Spitfireap commented on GitHub (Nov 2, 2022): okay, so it seems you updated everything **outside** your venv. Please update it with your venv : ``` source /srv/modoboa/env/bin/activate ``` then update modoboa with pip as you did and reapply changes in the guide where the line starts with `(env)`.
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#1672
No description provided.