fix: bootstrap pip via ensurepip if missing from venv
On Arch Linux, venvs can be created without pip seeded in. Detect the missing module before attempting pip install and recover with `python -m ensurepip --upgrade`. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -117,6 +117,12 @@ def setup_venv(dry_run=False):
|
|||||||
|
|
||||||
# Always (re-)install requirements so updates are picked up
|
# Always (re-)install requirements so updates are picked up
|
||||||
if not dry_run:
|
if not dry_run:
|
||||||
|
# Bootstrap pip if the venv was created without it (common on Arch)
|
||||||
|
code, _, _ = run_quiet([str(VENV_PYTHON), "-m", "pip", "--version"])
|
||||||
|
if code != 0:
|
||||||
|
info("pip not found in venv — bootstrapping via ensurepip …")
|
||||||
|
run([str(VENV_PYTHON), "-m", "ensurepip", "--upgrade"])
|
||||||
|
|
||||||
info("Installing / updating requirements …")
|
info("Installing / updating requirements …")
|
||||||
run([str(VENV_PYTHON), "-m", "pip", "install", "--quiet", "--upgrade", "pip"])
|
run([str(VENV_PYTHON), "-m", "pip", "install", "--quiet", "--upgrade", "pip"])
|
||||||
run([str(VENV_PYTHON), "-m", "pip", "install", "--quiet", "-r", str(REQUIREMENTS)])
|
run([str(VENV_PYTHON), "-m", "pip", "install", "--quiet", "-r", str(REQUIREMENTS)])
|
||||||
|
|||||||
Reference in New Issue
Block a user