dosubot[bot] commented on issue #37560:
URL: https://github.com/apache/superset/issues/37560#issuecomment-3822866492
<!-- Answer -->
The most common reason pyodbc is missing after a successful Docker build is
that one or more required system dependencies were not installed before running
`uv pip install pyodbc`. If unixODBC, msodbcsql18, or build-essential are
missing, the pyodbc install can silently fail or skip, and you won’t see errors
in the logs—just as you’re seeing now.
To fix this, make sure your Dockerfile installs all system dependencies
before installing pyodbc. Here’s a minimal working example for Debian-based
Superset images:
```dockerfile
FROM apache/superset:latest
USER root
RUN apt-get update && \
apt-get install -y build-essential unixodbc-dev curl gnupg2 && \
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | gpg
--dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg && \
curl -sSL https://packages.microsoft.com/config/debian/12/prod.list -o
/etc/apt/sources.list.d/mssql-release.list && \
apt-get update && \
ACCEPT_EULA=Y apt-get install -y msodbcsql18
RUN uv pip install --no-cache-dir pyodbc
USER superset
```
If you’re already doing this and still don’t see pyodbc, please check:
- Are you using a multi-stage Docker build or any later steps that might
overwrite the environment?
- Are you recreating the virtual environment anywhere in your Dockerfile
(e.g., with `python3 -m venv /app/.venv`)? This will break package visibility.
- What is the output of `uv pip list` inside the running container? (This is
more reliable than `pip list`.)
As an alternative, you can add `pyodbc` to `docker/requirements-local.txt`
and rebuild your image. The official bootstrap script will install it in the
correct environment at container startup.
Let me know if you need a full example or if you can share your complete
Dockerfile for review.
References:
[1](https://github.com/apache/superset/issues/36183#issuecomment-3552040461),
[2](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/Dockerfile#L117-L229)
<!-- 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/8232727d-5f56-4f47-ae7b-3ac143670c15?feedback_type=great_response)
|
[Irrelevant](https://app.dosu.dev/response-feedback/8232727d-5f56-4f47-ae7b-3ac143670c15?feedback_type=irrelevant_answer)
|
[Incorrect](https://app.dosu.dev/response-feedback/8232727d-5f56-4f47-ae7b-3ac143670c15?feedback_type=incorrect_sources)
|
[Verbose](https://app.dosu.dev/response-feedback/8232727d-5f56-4f47-ae7b-3ac143670c15?feedback_type=too_verbose)
|
[Hallucination](https://app.dosu.dev/response-feedback/8232727d-5f56-4f47-ae7b-3ac143670c15?feedback_type=hallucination)
| [Report
🐛](https://app.dosu.dev/response-feedback/8232727d-5f56-4f47-ae7b-3ac143670c15?feedback_type=bug_report)
|
[Other](https://app.dosu.dev/response-feedback/8232727d-5f56-4f47-ae7b-3ac143670c15?feedback_type=other)</sup>
[](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github) [](https://cursor.com/link/prompt?text=The%20most%20common%20reason%20pyodbc%20is%20missing%20after%20a%20successful%20Docker%20build%20is%20that%20one%20or%20more%20required%20system%20dependencies%20were%20not%20installed%20before%20running%20%60uv%20pip%20install%20pyodbc%60.%20If%20unixODBC%2C%20msodbcsql18%2C%20or%20build-essential%20are%20missing%2C%20the%20pyodbc%20install%20can%20silently%20fail%20or%20skip%2C%20and%20you%20won%E2%80%99t%20see%20errors%20in%20the%20logs%E2%80%94just%20as%20you%E2%80%99re%20seeing%20now.%0A%0ATo%20fix%20this%2C%20make%20sure%20your%20Dockerfile%20installs%20all%20system%20dependencies%20before%20installing%20pyodbc.%20Here%E2%80%99s%20a%20minimal%20working%20example%20for%20Debian-based%20Superset%20images%3A%0A%0A%60%60%60dockerfile%0AFROM%20apa
che/superset%3Alatest%0A%0AUSER%20root%0A%0ARUN%20apt-get%20update%20%26%26%20%5C%0A%20%20%20%20apt-get%20install%20-y%20build-essential%20unixodbc-dev%20curl%20gnupg2%20%26%26%20%5C%0A%20%20%20%20curl%20-sSL%20https%3A//packages.microsoft.com/keys/microsoft.asc%20%7C%20gpg%20--dearmor%20%3E%20/etc/apt/trusted.gpg.d/microsoft.gpg%20%26%26%20%5C%0A%20%20%20%20curl%20-sSL%20https%3A//packages.microsoft.com/config/debian/12/prod.list%20-o%20/etc/apt/sources.list.d/mssql-release.list%20%26%26%20%5C%0A%20%20%20%20apt-get%20update%20%26%26%20%5C%0A%20%20%20%20ACCEPT_EULA%3DY%20apt-get%20install%20-y%20msodbcsql18%0A%0ARUN%20uv%20pip%20install%20--no-cache-dir%20pyodbc%0A%0AUSER%20superset%0A%60%60%60%0A%0AIf%20you%E2%80%99re%20already%20doing%20this%20and%20still%20don%E2%80%99t%20see%20pyodbc%2C%20please%20check%3A%0A%0A-%20Are%20you%20using%20a%20multi-stage%20Docker%20build%20or%20any%20later%20steps%20that%20might%20overwrite%20the%20environment%3F%0A-%20Are%20you%20recreating%20the%2
0virtual%20environment%20anywhere%20in%20your%20Dockerfile%20%28e.g.%2C%20with%20%60python3%20-m%20venv%20/app/.venv%60%29%3F%20This%20will%20break%20package%20visibility.%0A-%20What%20is%20the%20output%20of%20%60uv%20pip%20list%60%20inside%20the%20running%20container%3F%20%28This%20is%20more%20reliable%20than%20%60pip%20list%60.%29%0A%0AAs%20an%20alternative%2C%20you%20can%20add%20%60pyodbc%60%20to%20%60docker/requirements-local.txt%60%20and%20rebuild%20your%20image.%20The%20official%20bootstrap%20script%20will%20install%20it%20in%20the%20correct%20environment%20at%20container%20startup.%0A%0ALet%20me%20know%20if%20you%20need%20a%20full%20example%20or%20if%20you%20can%20share%20your%20complete%20Dockerfile%20for%20review.%20%20%0AReferences%3A%20%5B1%5D%28https%3A//github.com/apache/superset/issues/36183%23issuecomment-3552040461%29%2C%20%5B2%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/Dockerfile%23L117-L229%29) [](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/issues/37560)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]