GitHub user Hariprasath-0018 added a comment to the discussion: Unable to Connect SQL Server Database in Apache Superset
Hi Dosu, I updated the Dockerfile you provided, rebuilt the image, and restarted Superset. However, I am still encountering the same error: ModuleNotFoundError: No module named 'pyodbc' Could you please guide me on how to resolve this issue? Thanks, Hariprasath N. On Fri, 30 Jan 2026 at 14:45, dosubot[bot] ***@***.***> wrote: > *dosubot[bot]* left a comment (apache/superset#37560) > <https://github.com/apache/superset/issues/37560#issuecomment-3822676275> > > This happens because in Superset 5.x+ Docker images, Python packages must > be installed with uv pip install (not just pip install) to be available > in the runtime environment. If you use pip install, pyodbc ends up > outside the virtual environment Superset actually uses, causing the > ModuleNotFoundError you’re seeing. > > To fix this, update your Dockerfile to install pyodbc like this (as root, > before switching back to the superset user): > > FROM apache/superset:latestUSER rootRUN uv pip install --no-cache-dir > pyodbcUSER superset > > Then rebuild your Docker image with docker compose build --force-rm (or docker > build --no-cache ...), and restart your container. After that, python -c > "import pyodbc; print(pyodbc.drivers())" inside the container should work > as expected. > > If you still have issues, please share your Dockerfile snippet and the > output of uv pip list or pip freeze inside the container so I can help > troubleshoot further. > > References: > > - Superset 5.x Dockerfile and package installation > > <https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/Dockerfile#L117-L226> > - Why 'uv pip install' is required for drivers like pyodbc > <https://github.com/apache/superset/issues/34557> > > *To reply, just mention @dosu <https://go.dosu.dev/dosubot>.* > ------------------------------ > > How did I do? Good > <https://app.dosu.dev/response-feedback/1ab75f12-a5ac-41e0-af92-d67295de3474?feedback_type=great_response> > | Irrelevant > <https://app.dosu.dev/response-feedback/1ab75f12-a5ac-41e0-af92-d67295de3474?feedback_type=irrelevant_answer> > | Incorrect > <https://app.dosu.dev/response-feedback/1ab75f12-a5ac-41e0-af92-d67295de3474?feedback_type=incorrect_sources> > | Verbose > <https://app.dosu.dev/response-feedback/1ab75f12-a5ac-41e0-af92-d67295de3474?feedback_type=too_verbose> > | Hallucination > <https://app.dosu.dev/response-feedback/1ab75f12-a5ac-41e0-af92-d67295de3474?feedback_type=hallucination> > | Report 🐛 > <https://app.dosu.dev/response-feedback/1ab75f12-a5ac-41e0-af92-d67295de3474?feedback_type=bug_report> > | Other > <https://app.dosu.dev/response-feedback/1ab75f12-a5ac-41e0-af92-d67295de3474?feedback_type=other> > > [image: Chat with Dosu] > <https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github> > [image: Open in Cursor] > <https://cursor.com/link/prompt?text=This%20happens%20because%20in%20Superset%205.x%2B%20Docker%20images%2C%20Python%20packages%20must%20be%20installed%20with%20%60uv%20pip%20install%60%20%28not%20just%20%60pip%20install%60%29%20to%20be%20available%20in%20the%20runtime%20environment.%20If%20you%20use%20%60pip%20install%60%2C%20pyodbc%20ends%20up%20outside%20the%20virtual%20environment%20Superset%20actually%20uses%2C%20causing%20the%20%60ModuleNotFoundError%60%20you%E2%80%99re%20seeing.%0A%0ATo%20fix%20this%2C%20update%20your%20Dockerfile%20to%20install%20pyodbc%20like%20this%20%28as%20root%2C%20before%20switching%20back%20to%20the%20%60superset%60%20user%29%3A%0A%0A%60%60%60dockerfile%0AFROM%20apache/superset%3Alatest%0AUSER%20root%0ARUN%20uv%20pip%20install%20--no-cache-dir%20pyodbc%0AUSER%20superset%0A%60%60%60%0A%0AThen%20rebuild%20your%20Docker%20image%20with%20%60docker%20compose%20build%20--force-rm%60%20%28or%20%60docker%20build%20--no-cache%20...%60%29%2C%20and%20restart%20 your%20container.%20After%20that%2C%20%60python%20-c%20%22import%20pyodbc%3B%20print%28pyodbc.drivers%28%29%29%22%60%20inside%20the%20container%20should%20work%20as%20expected.%0A%0AIf%20you%20still%20have%20issues%2C%20please%20share%20your%20Dockerfile%20snippet%20and%20the%20output%20of%20%60uv%20pip%20list%60%20or%20%60pip%20freeze%60%20inside%20the%20container%20so%20I%20can%20help%20troubleshoot%20further.%0A%0AReferences%3A%20%20%0A-%20%5BSuperset%205.x%20Dockerfile%20and%20package%20installation%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/Dockerfile%23L117-L226%29%20%20%0A-%20%5BWhy%20%27uv%20pip%20install%27%20is%20required%20for%20drivers%20like%20pyodbc%5D%28https%3A//github.com/apache/superset/issues/34557%29> > [image: Join Discord] <https://go.dosu.dev/discord-bot> [image: Share on > X] > <https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/37560> > > — > Reply to this email directly, view it on GitHub > <https://github.com/apache/superset/issues/37560#issuecomment-3822676275>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/BCNYORRCYMPWTV54WL2MYH34JMOKNAVCNFSM6AAAAACTMZQOACVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQMRSGY3TMMRXGU> > . > You are receiving this because you authored the thread.Message ID: > ***@***.***> > GitHub link: https://github.com/apache/superset/discussions/37650#discussioncomment-15687806 ---- 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]
