From b0b8874bad4f62840bdc6bfb1c8d57e0e8fc6d9c Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 8 Apr 2026 20:30:35 +0200 Subject: [PATCH] feat(python): reload env after venv creation to ensure pip uses virtualenv Fixes an issue where `PYTHON` could still point to the system interpreter when `scripts/install/python.sh` runs after `install-venv`. * Reload env layer if venv exists and PYTHON is not yet pointing to it * Reset env caching flags to force re-evaluation * Preserve central environment resolution logic (no hardcoding) This resolves Debian/PEP 668 `externally-managed-environment` errors during pip install. --- scripts/install/python.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/install/python.sh b/scripts/install/python.sh index 926c5778d3..703219b37c 100755 --- a/scripts/install/python.sh +++ b/scripts/install/python.sh @@ -1,6 +1,14 @@ #!/usr/bin/env bash set -euo pipefail +# 🔁 Reload env to pick up newly created venv +if [[ -n "${VENV:-}" && -x "${VENV}/bin/python" && "${PYTHON:-}" != "${VENV}/bin/python" ]]; then + unset INFINITO_ENV_LOADED + unset INFINITO_ENV_PYTHON_LOADED + # shellcheck source=scripts/meta/env/all.sh + source "${ENV_SH:-scripts/meta/env/all.sh}" +fi + : "${PYTHON:?PYTHON not set}" EXTRA="${1:-}"