ModuleNotFoundError: No module named 'authlib' when implementing Google OAuth with Apache Superset Docker #35183
Replies: 2 comments 3 replies
-
The issue is that Superset runs inside a Python virtual environment located at Here’s a recommended Dockerfile snippet: 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
USER superset
CMD ["gunicorn", "-w", "2", "--threads", "8", "-b", "0.0.0.0:8088", "superset.app:create_app()"] If you still see the error, try replacing the RUN /app/.venv/bin/pip install authlib==1.2.0 This directly targets the virtual environment Superset uses reference. For older Superset images (pre-v5), Alternatively, you can add dependencies to a To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
@dosu dockerfile
requirements-local.txt
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
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
Dockerfile
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! 🙏
Beta Was this translation helpful? Give feedback.
All reactions