Skip to content

ModuleNotFoundError: No module named 'pip' when testing DB connection (Shillelagh dependency) #39889

@DataStrategistTeam

Description

@DataStrategistTeam

Bug description

Description:

I encountered an error when testing a database connection in Superset. The request fails with:

ModuleNotFoundError: No module named 'pip'

Stack trace (relevant part):

File "/app/.venv/lib/python3.11/site-packages/shillelagh/functions.py", line 12, in <module>
    import pip
ModuleNotFoundError: No module named 'pip'

This originates from the Shillelagh dependency, which attempts to import pip at runtime.

Steps to reproduce:

  1. Deploy Superset in a minimal Python environment (e.g., Docker with Python 3.11 slim image)
  2. Create a virtual environment without pip (or where pip is not available)
  3. Attempt to test a database connection via the UI
  4. Observe failure

Expected behavior:
Testing a database connection should not depend on the presence of pip as an importable module.

Actual behavior:
The request fails due to ModuleNotFoundError: No module named 'pip'.

Environment:

  • Superset version: 6.0.0
  • Python version: 3.11
  • Deployment: Docker (minimal image)
  • OS: (e.g. Debian slim)

Screenshots/recordings

Image

Superset version

master / latest-dev

Python version

3.11

Node version

18 or greater

Browser

Chrome

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions