Skip to content

SAML - Problem loading pkg_resources #529

@thorin8k

Description

@thorin8k

Issue Summary
The pysaml module isn't working in the official Image

Environment

  • OS: Linux

  • API version: 9.1.0

  • Deployment: Docker

  • For self-hosted, WSGI environment: nginx/uwsg

  • Database: Postgres

  • Server config:
    Auth enabled? Yes
    Auth provider? SAML
    Customer views? No

  • web UI version: 8.7.1

  • CLI version: 8.5.3

To Reproduce
Steps to reproduce the behavior:

  1. Spin up a docker deployment based on https://github.com/alerta/docker-alerta/blob/master/examples/saml/docker-compose.yml
  2. View the startup logs: docker compose logs web
  3. The app wont start saying that the config is wrong:

Expected behavior
The system should start with the saml module loaded

Additional context
Image

The log says:

Traceback (most recent call last):

2026-04-27 08:07:17,160 DEBG 'uwsgi' stdout output:

  File "/venv/lib/python3.13/site-packages/alerta/auth/__init__.py", line 21, in register

    import saml2  # noqa

    ^^^^^^^^^^^^

  File "/venv/lib/python3.13/site-packages/saml2/__init__.py", line 24, in <module>

    from saml2.version import version as __version__

  File "/venv/lib/python3.13/site-packages/saml2/version.py", line 1, in <module>

    import pkg_resources as _pkg_resources

ModuleNotFoundError: No module named 'pkg_resources'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/app/wsgi.py", line 2, in <module>

    app = create_app()

  File "/venv/lib/python3.13/site-packages/alerta/app.py", line 88, in create_app

    app.register_blueprint(auth_blueprint)

    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^

  File "/venv/lib/python3.13/site-packages/flask/sansio/scaffold.py", line 47, in wrapper_func

    return f(self, *args, **kwargs)

  File "/venv/lib/python3.13/site-packages/flask/sansio/app.py", line 595, in register_blueprint

    blueprint.register(self, options)

    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^

  File "/venv/lib/python3.13/site-packages/alerta/auth/__init__.py", line 25, in register

    raise RuntimeError('Must install pysaml2 to use SAML2 authentication module')

RuntimeError: Must install pysaml2 to use SAML2 authentication module

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions