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) -------------------------------------------------