Check pip availability before running ensurepip#392
Open
priyagupta108 wants to merge 1 commit intoactions:mainfrom
Open
Check pip availability before running ensurepip#392priyagupta108 wants to merge 1 commit intoactions:mainfrom
priyagupta108 wants to merge 1 commit intoactions:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request improves the robustness of the Python toolcache setup templates by only running ensurepip when pip is not already importable for the target interpreter, avoiding redundant bootstrapping steps across Windows, Linux, and macOS.
Changes:
- Windows: check
import pipbefore invokingpython -m ensurepip. - Linux/macOS: gate
./python -m ensurepipbehind animport pipcheck (with stderr suppressed). - Keep the existing
pip install --upgrade --force-reinstall pip ...upgrade flow unchanged.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| installers/win-setup-template.ps1 | Adds a pip import check before running ensurepip, then upgrades/reinstalls pip as before. |
| installers/nix-setup-template.sh | Runs ensurepip only when pip isn’t importable, then performs the same pip upgrade/reinstall. |
| installers/macos-pkg-setup-template.sh | Mirrors the nix template change: conditionally run ensurepip based on import pip, then upgrade/reinstall. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lmvysakh
approved these changes
May 8, 2026
priya-kinthali
approved these changes
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request improves the robustness of the Python installation scripts across macOS, Linux, and Windows by ensuring that
pipis only bootstrapped withensurepipif it is not already present. This prevents unnecessary reinstallation and potential errors during setup.