Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Error starting postorius with postgres: initialization of _psycopg raised unreported exception #664

Open
Skyr opened this issue Nov 18, 2023 · 1 comment
Labels

Comments

@Skyr
Copy link

Skyr commented Nov 18, 2023

Tag/version of Container Images: 0.4.6

settings_local.py just empties the MAILMAN_WEB_SOCIAL_AUTH array.

When starting the postorius image, it immediately crashes with the following output:

Postgres is up - continuing
Copying settings_local.py ...
Traceback (most recent call last):
  File "/opt/mailman-web/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python3.11/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python3.11/site-packages/django/core/management/__init__.py", line 420, in execute
    django.setup()
  File "/usr/lib/python3.11/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/lib/python3.11/site-packages/django/apps/registry.py", line 116, in populate
    app_config.import_models()
  File "/usr/lib/python3.11/site-packages/django/apps/config.py", line 269, in import_models
    self.models_module = import_module(models_module_name)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3.11/site-packages/postorius/models.py", line 37, in <module>
    from postorius.utils import LANGUAGES, get_mailman_client
  File "/usr/lib/python3.11/site-packages/postorius/utils.py", line 25, in <module>
    from allauth.account.models import EmailAddress
  File "/usr/lib/python3.11/site-packages/allauth/account/models.py", line 14, in <module>
    from .adapter import get_adapter
  File "/usr/lib/python3.11/site-packages/allauth/account/adapter.py", line 17, in <module>
    from django.contrib.auth.models import AbstractUser
  File "/usr/lib/python3.11/site-packages/django/contrib/auth/models.py", line 3, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "/usr/lib/python3.11/site-packages/django/contrib/auth/base_user.py", line 50, in <module>
    class AbstractBaseUser(models.Model):
  File "/usr/lib/python3.11/site-packages/django/db/models/base.py", line 141, in __new__
    new_class.add_to_class("_meta", Options(meta, app_label))
  File "/usr/lib/python3.11/site-packages/django/db/models/base.py", line 369, in add_to_class
    value.contribute_to_class(cls, name)
  File "/usr/lib/python3.11/site-packages/django/db/models/options.py", line 231, in contribute_to_class
    self.db_table, connection.ops.max_name_length()
                   ^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/django/utils/connection.py", line 15, in __getattr__
    return getattr(self._connections[self._alias], item)
                   ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/django/utils/connection.py", line 62, in __getitem__
    conn = self.create_connection(alias)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/django/db/utils.py", line 193, in create_connection
    backend = load_backend(db["ENGINE"])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/django/db/utils.py", line 113, in load_backend
    return import_module("%s.base" % backend_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/django/db/backends/postgresql/base.py", line 24, in <module>
    import psycopg2 as Database
  File "/usr/lib/python3.11/site-packages/psycopg2/__init__.py", line 51, in <module>
    from psycopg2._psycopg import (                     # noqa
SystemError: initialization of _psycopg raised unreported exception

Comparing the 0.4.6 image to 0.4.5, I noticed that the Python version changed from 3.10 to 3.11. So this might be related to some Python version mismatch like described here: psycopg/psycopg2#1144

@Skyr Skyr added the bug label Nov 18, 2023
@maxking
Copy link
Owner

maxking commented Jun 8, 2024

Which version of psycopg2 and postgresql are you using? We recently bumped the version of postgresql in our compose file to 12 from 11 for some bugs I remember seeing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants