Repository navigation
Conversation
This PR needs a
|
Fresh uv virtual environments do not include pip. Use pip when available, or fall back to uv pip targeting the running Python interpreter. Cache the choice so installing pip as a build dependency does not change installers midway through the process. Use the shared command for dependency bootstrap and package installation, preserve pip's index selection behavior, and remove the redundant pip-only upgrade strategy option. Document how to set up a uv environment.
e67faf5 to
747c22d
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Installer selection and caching lack automated test coverage, leaving fallback behavior and sticky installer selection unprotected against regressions.
1 open issue
What changed in this PR
This PR enables source installation in fresh uv environments without pip, addressing the installation failures described in #15907 and #24417.
Changes:
- Adds cached installer selection that prefers pip and otherwise uses uv targeting the running Python.
- Routes dependency bootstrapping and package installation through the shared helper.
- Documents uv environment setup.
| File | Description |
|---|---|
install_utils.py |
Adds installer selection and uses it to bootstrap packaging. |
install_requirements.py |
Uses the shared installer for dependencies and removes a pip-specific option. |
install_executorch.py |
Uses the shared installer for ExecuTorch installation. |
docs/source/using-executorch-building-from-source.md |
Documents uv setup and installer fallback behavior. |
Review effort: Balanced
| @functools.lru_cache(maxsize=1) | ||
| def get_package_install_command() -> Tuple[str, ...]: | ||
| """Choose an installer once, even if requirements later install pip.""" | ||
| if importlib.util.find_spec("pip") is not None: |
There was a problem hiding this comment.
🔵 Needs a closer look
Installer selection and caching lack automated regression tests covering pip preference, uv fallback targeting the running interpreter, neither installer being available, and retention of the cached uv choice.
Review effort: Balanced

Summary
Fixes #15907, #24417
Fresh uv virtual environments do not include pip, causing installation to fail while bootstrapping
packaging.Prefer pip when available; otherwise use uv targeting the running Python environment. Keep the installer choice fixed throughout installation and document uv setup.
Test plan
Verify that source installation completes successfully in all three configurations below. Use a fresh
.venvfor each case.1. uv available, pip initially unavailable
2. Both uv and pip available
3. pip available, uv unavailable
Result: All three configurations passed.
cc @nil-is-all