GitHub user dosubot[bot] added a comment to the discussion: ModuleNotFoundError: No module named 'authlib' when implementing Google OAuth with Apache Superset Docker
<!-- Answer --> The issue is that Superset runs inside a Python virtual environment located at `/app/.venv`, and installing packages with `uv pip install` or `pip install` as root may not always target the correct environment used at runtime. To ensure `authlib` is available, install it using either `uv pip install authlib` or `/app/.venv/bin/pip install authlib` in your Dockerfile before switching to the `superset` user. This guarantees the package is installed in the environment Superset uses when running as `superset` [reference](https://github.com/apache/superset/issues/32186) [reference](https://github.com/apache/superset/issues/34557). Here’s a recommended Dockerfile snippet: ```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 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 `uv pip install ...` line with: ```dockerfile RUN /app/.venv/bin/pip install authlib==1.2.0 ``` This directly targets the virtual environment Superset uses [reference](https://github.com/apache/superset/issues/32186). For older Superset images (pre-v5), `uv` may not be available, so use `/app/.venv/bin/pip install <package>` instead [reference](https://github.com/apache/superset/issues/32733). Alternatively, you can add dependencies to a `requirements-local.txt` file and rebuild your image via docker-compose, but for a standalone Dockerfile, the above approach is recommended [reference](https://github.com/apache/superset/issues/34557). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/73ab2a87-9422-4ff9-945c-66eb5c6c8f25?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/73ab2a87-9422-4ff9-945c-66eb5c6c8f25?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/73ab2a87-9422-4ff9-945c-66eb5c6c8f25?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/73ab2a87-9422-4ff9-945c-66eb5c6c8f25?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/73ab2a87-9422-4ff9-945c-66eb5c6c8f25?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/73ab2a87-9422-4ff9-945c-66eb5c6c8f25?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/73ab2a87-9422-4ff9-945c-66eb5c6c8f25?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)& nbsp;[](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/35183) GitHub link: https://github.com/apache/superset/discussions/35183#discussioncomment-14437969 ---- 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