scripts: detect and recreate broken venv (pip missing after python3-venv not installed)
Nightly Build / build (push) Successful in 6m28s
Nightly Build / build (push) Successful in 6m28s
This commit is contained in:
+5
-1
@@ -261,7 +261,11 @@ info "🔧 Setting up Python virtual environment …"
|
||||
VENV_DIR="${INSTALL_DIR}/.venv"
|
||||
REQUIREMENTS="${INSTALL_DIR}/requirements.txt"
|
||||
|
||||
if [ ! -f "$VENV_DIR/bin/python3" ]; then
|
||||
# A venv is usable only if python3 AND pip both work. Ubuntu's `python3 -m venv`
|
||||
# without the python3-venv package leaves a venv with python3 but no pip — detect
|
||||
# that and recreate, so a broken venv never survives a restart.
|
||||
if [ ! -f "$VENV_DIR/bin/python3" ] || ! "$VENV_DIR/bin/python3" -m pip --version >/dev/null 2>&1; then
|
||||
rm -rf "$VENV_DIR"
|
||||
if command -v uv >/dev/null 2>&1; then
|
||||
uv venv --seed "$VENV_DIR" && uv pip install -r "$REQUIREMENTS" \
|
||||
&& info "✔ Python venv ready (uv)" \
|
||||
|
||||
Reference in New Issue
Block a user