GitHub user Ikarashi0310 created a discussion: ModuleNotFoundError: No module named 'authlib' when implementing Google OAuth with Apache Superset Docker
I'm encountering a ModuleNotFoundError: No module named 'authlib' error while hosting Apache Superset and attempting to implement Google authentication (OAuth). I'm blocked by this persistent error and cannot proceed. I have attempted to explicitly install authlib in my custom Dockerfile. **Error Log** ``` Traceback (most recent call last): File "/app/superset/app.py", line 40, in create_app app_initializer.init_app() File "/app/superset/initialization/__init__.py", line 489, in init_app self.init_app_in_ctx() File "/app/superset/initialization/__init__.py", line 413, in init_app_in_ctx self.configure_fab() File "/app/superset/utils/decorators.py", line 266, in wrapped return on_error(ex) File "/app/superset/utils/decorators.py", line 236, in on_error raise ex File "/app/superset/utils/decorators.py", line 259, in wrapped result = func(*args, **kwargs) File "/app/superset/initialization/__init__.py", line 566, in configure_fab appbuilder.init_app(self.superset_app, db.session) File "/usr/local/lib/python3.10/site-packages/flask_appbuilder/base.py", line 211, in init_app self.sm = self.security_manager_class(self) File "/usr/local/lib/python3.10/site-packages/flask_appbuilder/security/sqla/manager.py", line 62, in __init__ super(SecurityManager, self).__init__(appbuilder) File "/usr/local/lib/python3.10/site-packages/flask_appbuilder/security/manager.py", line 278, in __init__ from authlib.integrations.flask_client import OAuth ModuleNotFoundError: No module named 'authlib' Traceback (most recent call last): File "/usr/local/bin/superset", line 7, in <module> sys.exit(superset()) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1157, in __call__ return self.main(*args, **kwargs) ... (rest of the log, similar ModuleNotFoundError) ModuleNotFoundError: No module named 'authlib' ``` **Dockerfile** ``` FROM apache/superset:latest USER root RUN apt update && apt install -y \ python3-dev \ default-libmysqlclient-dev \ build-essential \ pkg-config \ && rm -rf /var/lib/apt/lists/* RUN uv pip install --no-cache-dir mysqlclient pymysql gunicorn authlib==1.2.0 COPY superset_config.py /app/superset_home/superset_config.py RUN chown superset:superset /app/superset_home/superset_config.py USER superset CMD ["gunicorn", "-w", "2", "--threads", "8", "-b", "0.0.0.0:8088", "superset.app:create_app()"] ``` **Question** Even though I explicitly run uv pip install ... authlib==1.2.0 as the root user, the application is failing to import authlib when running as the superset user, resulting in a ModuleNotFoundError. Why is the authlib package not being found, and how can I correctly install this dependency within the Superset image for OAuth to work? **Potential Hint / Context** I noticed in the official Superset documentation that dependencies are sometimes suggested to be added to a docker/requirements-local.txt file and rebuilt via docker-compose. However, I am trying to build a custom image using a standalone Dockerfile. Could the issue be related to: The uv pip install command placing the package in a location not accessible or recognized by the superset user/environment? The apache/superset:latest base image using a Python virtual environment that isn't being targeted by the uv pip install command? Any guidance on the correct way to layer dependencies onto the apache/superset base image to enable Google OAuth is greatly appreciated! 🙏 GitHub link: https://github.com/apache/superset/discussions/35183 ---- This is an automatically sent email for notifications@superset.apache.org. To unsubscribe, please send an email to: notifications-unsubscr...@superset.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org