GitHub user dosubot[bot] added a comment to the discussion: Superset Dev Image 
Not Exposing ECharts via API + Issues Connecting to Trino in Superset 5.0

<!-- Answer -->
The error happens because the virtual environment at `/app/.venv` (and its 
`pip` executable) doesn't exist at the point in the Docker build when your 
command runs. Superset images set up the virtual environment during their own 
build process, so if you extend the image, you need to activate it before 
installing packages.

The recommended way is to use the `uv` tool inside the activated environment. 
In your Dockerfile, use:

```dockerfile
FROM apache/superset:latest

USER root

RUN . /app/.venv/bin/activate && \
    uv pip install sqlalchemy-trino psycopg2-binary
```

This ensures the packages are installed in the correct Python environment that 
Superset uses. If you're using an older Superset image (pre-4.1), replace `uv 
pip install ...` with just `pip install ...` after activating the environment. 
More details and examples are in the official docs and recent Dockerfile 
updates 
([source](https://github.com/apache/superset/blob/master/docs/docs/installation/docker-builds.mdx),
 [source](https://github.com/apache/superset/pull/34908)).

If you still see the error, double-check your base image tag and confirm that 
`/app/.venv` exists in the image you are extending.


<!-- 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/82385e18-b396-4465-a200-89a237bbda3e?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/82385e18-b396-4465-a200-89a237bbda3e?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/82385e18-b396-4465-a200-89a237bbda3e?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/82385e18-b396-4465-a200-89a237bbda3e?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/82385e18-b396-4465-a200-89a237bbda3e?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/82385e18-b396-4465-a200-89a237bbda3e?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/82385e18-b396-4465-a200-89a237bbda3e?feedback_type=other)</sup>

[![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=The%20error%20happens%20because%20the%20virtual%20environment%20at%20%60/app/.venv%60%20%28and%20its%20%60pip%60%20executable%29%20doesn%27t%20exist%20at%20the%20point%20in%20the%20Docker%20build%20when%20your%20command%20runs.%20Superset%20images%20set%20up%20the%20virtual%20environment%20during%20their%20own%20build%20process%2C%20so%20if%20you%20extend%20the%20image%2C%20you%20need%20to%20activate%20it%20before%20installing%20packages.%0A%0AThe%20recommended%20way%20is%20to%20use%20the%20%60uv%60%20tool%20inside%20the%20activated%20environment.%20In%20your%20Dockerfile%2C%20use%3A%0A%0A%60%60%60dockerfile%0AFROM%20apache/superset%3Alatest%0A%0AUSER%20root%0A%0ARUN%20.%20/app/.venv/bin/activate%20%26%26%20%5C%0A%20%20%20%20uv%20pip%20install%20sqlal
 
chemy-trino%20psycopg2-binary%0A%60%60%60%0A%0AThis%20ensures%20the%20packages%20are%20installed%20in%20the%20correct%20Python%20environment%20that%20Superset%20uses.%20If%20you%27re%20using%20an%20older%20Superset%20image%20%28pre-4.1%29%2C%20replace%20%60uv%20pip%20install%20...%60%20with%20just%20%60pip%20install%20...%60%20after%20activating%20the%20environment.%20More%20details%20and%20examples%20are%20in%20the%20official%20docs%20and%20recent%20Dockerfile%20updates%20%28%5Bsource%5D%28https%3A//github.com/apache/superset/blob/master/docs/docs/installation/docker-builds.mdx%29%2C%20%5Bsource%5D%28https%3A//github.com/apache/superset/pull/34908%29%29.%0A%0AIf%20you%20still%20see%20the%20error%2C%20double-check%20your%20base%20image%20tag%20and%20confirm%20that%20%60/app/.venv%60%20exists%20in%20the%20image%20you%20are%20extending.)&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 o
 n 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/36434)

GitHub link: 
https://github.com/apache/superset/discussions/36434#discussioncomment-15176905

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to