Skip to content

python-base: make pip importable so python -m pip works - #523

Open
mapy1874 wants to merge 1 commit into
mainfrom
python-base-importable-pip
Open

mapy1874 wants to merge 1 commit into
mainfrom
python-base-importable-pip

Conversation

@mapy1874

Copy link
Copy Markdown

Why

In conversation sandboxes and Python projects, python3 -m pip fails with No module named pip, even though the pip command works. Agents and users often run python -m pip install .... In a Nov 25 sample of conversation-agent errors, a missing pip was the second most common missing module (23 hits). Context: https://replit.slack.com/archives/C0C7FQPD1PA/p1795594739722719

What changed

python-base already installs our pip package on PATH, but the wrapped interpreter's sys.path never includes it. This change appends pip's site-packages to REPLIT_PYTHONPATH, which sitecustomize adds to the end of sys.path, after .pythonlibs and setuptools. A pip the user installs into .pythonlibs still wins. The python module already does the same thing through PYTHONPATH.

No other packages are added.

Test plan

  • Built .#"python-base-3.13" with and without the change, sourced its replit-env in a clean shell, and ran python3 -m pip --version.
    • Before: No module named pip.
    • After: pip 26.2.2 from .../python3.13-pip-26.2.2/....
  • pip --version works before and after.

Rollout

  • This is fully backward and forward compatible

Chat about this change

~ written by ⠕ Replit

@mapy1874
mapy1874 requested a review from a team as a code owner November 25, 2026 22:37
@mapy1874
mapy1874 requested review from vlinkz and removed request for a team November 25, 2026 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant