Skip to content

authlib already installed, but No module named 'authlib' #22149

Description

@inspirerit

I running helm use this template
and enabled oauth follwing config:

  enable_oauth: |
     from flask_appbuilder.security.manager import (AUTH_DB, AUTH_OAUTH)
     AUTH_TYPE = AUTH_OAUTH
     OAUTH_PROVIDERS = [
         {
             "name": "google",
             "whitelist": [ os.getenv("OAUTH_WHITELIST_REGEX", "") ],
             "icon": "fa-google",
             "token_key": "access_token",
             "remote_app": {
                 "client_id": os.environ.get("GOOGLE_KEY"),
                 "client_secret": os.environ.get("GOOGLE_SECRET"),
                 "api_base_url": "https://www.googleapis.com/oauth2/v2/",
                 "client_kwargs": {"scope": "email profile"},
                 "request_token_url": None,
                 "access_token_url": "https://accounts.google.com/o/oauth2/token",
                 "authorize_url": "https://accounts.google.com/o/oauth2/auth",
                 "authorize_params": {"hd": os.getenv("OAUTH_HOME_DOMAIN", "")}
             }
         }
     ]

I also preinstall authlib package to superset image
ex. Dockerfile

FROM apache/superset:latest
RUN pip install --no-cache-dir authlib

.But when I run helm to deploy, it still have error:

....
Failed to create app
Traceback (most recent call last):
  File "/app/superset/app.py", line 37, in create_app
    app_initializer.init_app()
  File "/app/superset/initialization/__init__.py", line 473, in init_app
    self.init_app_in_ctx()
  File "/app/superset/initialization/__init__.py", line 418, in init_app_in_ctx
    self.configure_fab()
  File "/app/superset/initialization/__init__.py", line 517, in configure_fab
    appbuilder.init_app(self.superset_app, db.session)
  File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/base.py", line 211, in init_app
    self.sm = self.security_manager_class(self)
  File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/security/sqla/manager.py", line 62, in __init__
    super(SecurityManager, self).__init__(appbuilder)
  File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/security/manager.py", line 263, in __init__
    from authlib.integrations.flask_client import OAuth
ModuleNotFoundError: No module named 'authlib'

So anyone have solution to fix that, I try downgrade authlib to 0.15.x version but still have the same error

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