Skip to content

Conversation

@CalvinAllen
Copy link
Contributor

Summary

  • Replace get-pip.py with ensurepip --default-pip --upgrade as primary pip installation method
  • Reorder Install() to configure pip before creating shims
  • Add fallback to get-pip.py for edge cases
  • Add unit tests for enableSitePackages and shim configuration

Problem

Windows Python installations from two different sources had pip issues:

Source Issue
python.org embeddable pip not included at all
python-build-standalone pip module works, but pip.exe has broken embedded build paths

Users installing Python 3.14.2 on Windows saw "Failed to install pip" warnings (issue #201).

Solution

Use python -m ensurepip --default-pip --upgrade which:

  • Works on both distribution types
  • Creates working pip.exe, pip3.exe, pipX.Y.exe executables
  • Generates scripts with correct paths (since it runs post-installation)
  • Falls back to get-pip.py if ensurepip fails

Changes

src/runtimes/python/provider.go

  • Reordered install flow: pip → shims (so executables exist before shims are created)
  • New installPip() using ensurepip as primary method
  • New installPipWithGetPip() as fallback
  • enableSitePackages() now best-effort (ignores missing ._pth files)

src/runtimes/python/provider_test.go

  • Added TestPythonProvider_EnableSitePackages (4 test cases)
  • Added TestPythonProvider_Shims (verifies pip/pip3 shims configured)

Test plan

  • Unit tests pass (go test ./runtimes/python/...)
  • All tests pass (go test ./...)
  • Linter passes (golangci-lint run ./...)
  • Integration test with Python 3.14.2 on Windows (PR pending in .github repo)

Fixes #201

CalvinAllen added a commit to CodingWithCalvin/.github that referenced this pull request Jan 25, 2026
- Add "Verify pip shim works" step to test pip --version via shim
- Add "Verify pip module works" step to test python -m pip --version
- Update Windows matrix to use Python 3.14.2 (reported in dtvem.cli#201)
- Update summary table to include pip verification results

This ensures the pip installation fix in dtvem.cli is properly tested,
particularly on Windows where pip.exe had issues with embedded paths.

Related: CodingWithCalvin/dtvem.cli#201, CodingWithCalvin/dtvem.cli#207
CalvinAllen added a commit to CodingWithCalvin/.github that referenced this pull request Jan 25, 2026
- Add "Verify pip shim works" step to test pip --version via shim
- Add "Verify pip module works" step to test python -m pip --version
- Update Windows matrix to use Python 3.14.2 (reported in dtvem.cli#201)
- Update summary table to include pip verification results

This ensures the pip installation fix in dtvem.cli is properly tested,
particularly on Windows where pip.exe had issues with embedded paths.

Related: CodingWithCalvin/dtvem.cli#201, CodingWithCalvin/dtvem.cli#207
CalvinAllen added a commit to CodingWithCalvin/.github that referenced this pull request Jan 25, 2026
…53)

- Add "Verify pip shim works" step to test pip --version via shim
- Add "Verify pip module works" step to test python -m pip --version
- Update Windows matrix to use Python 3.14.2 (reported in dtvem.cli#201)
- Update summary table to include pip verification results

This ensures the pip installation fix in dtvem.cli is properly tested,
particularly on Windows where pip.exe had issues with embedded paths.

Related: CodingWithCalvin/dtvem.cli#201, CodingWithCalvin/dtvem.cli#207
- Replace get-pip.py with ensurepip --default-pip --upgrade as primary method
- Reorder Install() to configure pip before creating shims
- Make ._pth file modification best-effort (for python.org embeddable)
- Keep get-pip.py as fallback for edge cases
- Add unit tests for enableSitePackages and shim configuration

This fixes pip installation failures on Windows where:
1. python.org embeddable packages don't include pip
2. python-build-standalone has pip but pip.exe has broken embedded paths

Running ensurepip post-installation creates working pip executables with
correct paths regardless of the distribution source.

Fixes #201
@CalvinAllen CalvinAllen force-pushed the fix/python/ensurepip-installation branch from d548477 to a8557b1 Compare January 25, 2026 22:47
@CalvinAllen CalvinAllen merged commit 94606cf into main Jan 25, 2026
12 checks passed
@CalvinAllen CalvinAllen deleted the fix/python/ensurepip-installation branch January 25, 2026 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Failed to automatically install pip - Python 3.14.2

2 participants