install.sh: rebuild venv if pip missing (Debian 13 / Python 3.13 quirk)
On Debian 13 with Python 3.13, `python3 -m venv` sometimes finishes without pip if the user pasted commands that got interrupted (Ctrl-Z, broken pipe). Now we (1) detect missing pip and tear down + recreate the venv, (2) fall back to `ensurepip` if even a fresh venv lacks pip. Also dropped --quiet so install progress is visible.
This commit is contained in:
+10
-3
@@ -71,14 +71,21 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# ---- virtualenv + python deps ---------------------------------------------
|
# ---- virtualenv + python deps ---------------------------------------------
|
||||||
if [[ ! -x "$INSTALL_DIR/.venv/bin/python" ]]; then
|
# Venv: rebuild if python OR pip missing (Debian 13 / Python 3.13 sometimes
|
||||||
|
# creates a venv without pip — we fall back to `ensurepip` in that case).
|
||||||
|
if [[ ! -x "$INSTALL_DIR/.venv/bin/python" ]] || [[ ! -x "$INSTALL_DIR/.venv/bin/pip" ]]; then
|
||||||
log "Creating Python venv..."
|
log "Creating Python venv..."
|
||||||
|
rm -rf "$INSTALL_DIR/.venv"
|
||||||
sudo -u "$SVC_USER" python3 -m venv "$INSTALL_DIR/.venv"
|
sudo -u "$SVC_USER" python3 -m venv "$INSTALL_DIR/.venv"
|
||||||
|
if [[ ! -x "$INSTALL_DIR/.venv/bin/pip" ]]; then
|
||||||
|
log "pip not found in venv — running ensurepip..."
|
||||||
|
sudo -u "$SVC_USER" "$INSTALL_DIR/.venv/bin/python" -m ensurepip --upgrade
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "Installing Python dependencies (build123d pulls OpenCASCADE — may take a few minutes)..."
|
log "Installing Python dependencies (build123d pulls OpenCASCADE — may take a few minutes)..."
|
||||||
sudo -u "$SVC_USER" "$INSTALL_DIR/.venv/bin/pip" install --quiet --upgrade pip
|
sudo -u "$SVC_USER" "$INSTALL_DIR/.venv/bin/pip" install --upgrade pip
|
||||||
sudo -u "$SVC_USER" "$INSTALL_DIR/.venv/bin/pip" install --quiet \
|
sudo -u "$SVC_USER" "$INSTALL_DIR/.venv/bin/pip" install \
|
||||||
-r "$INSTALL_DIR/requirements.txt" gunicorn
|
-r "$INSTALL_DIR/requirements.txt" gunicorn
|
||||||
|
|
||||||
# ---- data dir (for SQLite) -------------------------------------------------
|
# ---- data dir (for SQLite) -------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user