From a16952f7c55b9f1310ec68e3f7bf4c8e5e21f72e Mon Sep 17 00:00:00 2001 From: wenil Date: Mon, 25 May 2026 09:23:20 +0300 Subject: [PATCH] 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. --- deploy/install.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/deploy/install.sh b/deploy/install.sh index a80805b..5fbc65e 100644 --- a/deploy/install.sh +++ b/deploy/install.sh @@ -71,14 +71,21 @@ else fi # ---- 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..." + rm -rf "$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 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 --quiet \ +sudo -u "$SVC_USER" "$INSTALL_DIR/.venv/bin/pip" install --upgrade pip +sudo -u "$SVC_USER" "$INSTALL_DIR/.venv/bin/pip" install \ -r "$INSTALL_DIR/requirements.txt" gunicorn # ---- data dir (for SQLite) -------------------------------------------------