GitHub user dosubot[bot] added a comment to the discussion: Issue in psycopg2 
while upgrading from 4.x to 5.0

<!-- Answer -->
This error happens because Superset 5.0.0 Docker/Helm images are now "lean" and 
do not include database drivers like psycopg2-binary by default. Also, Superset 
v5 switched from pip to uv as the Python package manager, so installing with 
pip may not actually install the driver in the environment Superset uses 
[ref](https://github.com/apache/superset/issues/32364) 
[ref](https://github.com/apache/superset/pull/33872).

To fix this, update your Helm chart's bootstrapScript to install 
psycopg2-binary using uv inside the Superset virtual environment. For example:

```yaml
bootstrapScript: |
  #!/bin/bash
  apt update && apt install -y gcc libpq-dev python3-dev pkg-config
  /app/.venv/bin/uv pip install psycopg2-binary
```

This ensures psycopg2 is available where Superset expects it. You can verify 
the install by running `/app/.venv/bin/python -c "import psycopg2"` in the pod.

These steps are required for all production/lean images starting from Superset 
4.1.x and above, not just 5.0.0 
[ref](https://github.com/apache/superset/issues/32186) 
[ref](https://github.com/apache/superset/discussions/31431).


<!-- 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/8a8a29a2-bf18-428c-a5ff-e3bd9c1a8695?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/8a8a29a2-bf18-428c-a5ff-e3bd9c1a8695?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/8a8a29a2-bf18-428c-a5ff-e3bd9c1a8695?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/8a8a29a2-bf18-428c-a5ff-e3bd9c1a8695?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/8a8a29a2-bf18-428c-a5ff-e3bd9c1a8695?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/8a8a29a2-bf18-428c-a5ff-e3bd9c1a8695?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/8a8a29a2-bf18-428c-a5ff-e3bd9c1a8695?feedback_type=other)</sup>&nbsp;&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Sh
 are on 
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/34109)

GitHub link: 
https://github.com/apache/superset/discussions/34109#discussioncomment-13702356

----
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

Reply via email to