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
@@ -256,7 +256,11 @@ info "🔧 Setting up Python virtual environment …"
|
|||||||
VENV_DIR="${INSTALL_DIR}/.venv"
|
VENV_DIR="${INSTALL_DIR}/.venv"
|
||||||
REQUIREMENTS="${INSTALL_DIR}/requirements.txt"
|
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
|
if command -v uv >/dev/null 2>&1; then
|
||||||
uv venv --seed "$VENV_DIR" && uv pip install -r "$REQUIREMENTS" \
|
uv venv --seed "$VENV_DIR" && uv pip install -r "$REQUIREMENTS" \
|
||||||
&& info "✔ Python venv ready (uv)" \
|
&& info "✔ Python venv ready (uv)" \
|
||||||
|
|||||||
+5
-1
@@ -261,7 +261,11 @@ info "🔧 Setting up Python virtual environment …"
|
|||||||
VENV_DIR="${INSTALL_DIR}/.venv"
|
VENV_DIR="${INSTALL_DIR}/.venv"
|
||||||
REQUIREMENTS="${INSTALL_DIR}/requirements.txt"
|
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
|
if command -v uv >/dev/null 2>&1; then
|
||||||
uv venv --seed "$VENV_DIR" && uv pip install -r "$REQUIREMENTS" \
|
uv venv --seed "$VENV_DIR" && uv pip install -r "$REQUIREMENTS" \
|
||||||
&& info "✔ Python venv ready (uv)" \
|
&& info "✔ Python venv ready (uv)" \
|
||||||
|
|||||||
+5
-1
@@ -11,7 +11,11 @@ cd "$(dirname "$0")"
|
|||||||
VENV_DIR=".venv"
|
VENV_DIR=".venv"
|
||||||
REQUIREMENTS="requirements.txt"
|
REQUIREMENTS="requirements.txt"
|
||||||
|
|
||||||
if [ ! -f "$VENV_DIR/bin/python3" ] && [ -f "$REQUIREMENTS" ]; 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 "$REQUIREMENTS" ] && { [ ! -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
|
if command -v uv >/dev/null 2>&1; then
|
||||||
echo "[run-docker.sh] Setting up Python venv with uv …"
|
echo "[run-docker.sh] Setting up Python venv with uv …"
|
||||||
uv venv --seed "$VENV_DIR" && uv pip install -r "$REQUIREMENTS" \
|
uv venv --seed "$VENV_DIR" && uv pip install -r "$REQUIREMENTS" \
|
||||||
|
|||||||
@@ -50,7 +50,11 @@ fi
|
|||||||
VENV_DIR=".venv"
|
VENV_DIR=".venv"
|
||||||
REQUIREMENTS="requirements.txt"
|
REQUIREMENTS="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
|
if command -v uv >/dev/null 2>&1; then
|
||||||
echo "[run.sh] Setting up Python venv with uv …"
|
echo "[run.sh] Setting up Python venv with uv …"
|
||||||
uv venv --seed "$VENV_DIR" && uv pip install -r "$REQUIREMENTS" \
|
uv venv --seed "$VENV_DIR" && uv pip install -r "$REQUIREMENTS" \
|
||||||
|
|||||||
Reference in New Issue
Block a user