From a2fd9b1ce6243f4fc947eae9ac293fe5e6f97353 Mon Sep 17 00:00:00 2001 From: Daniel Bedeleanu Date: Wed, 22 Apr 2026 18:29:15 +0300 Subject: [PATCH] fix(6): update standalone start_server.sh to use Python virtual environment - Create .venv automatically if missing - Activate virtual environment before pip install - Fixes PEP 668 externally-managed-environment error on Python 3.12 - Virtual environment isolated from system Python packages --- start_server.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/start_server.sh b/start_server.sh index 78ba96df..8011f321 100755 --- a/start_server.sh +++ b/start_server.sh @@ -104,6 +104,16 @@ if [[ ! -f "requirements.txt" ]]; then log_error "backend/requirements.txt not found" fi +# Create and use Python virtual environment +VENV_DIR="../.venv" +if [[ ! -d "$VENV_DIR" ]]; then + log_info " Creating Python virtual environment..." + python3 -m venv "$VENV_DIR" || log_error "Failed to create virtual environment" +fi + +# Activate virtual environment +source "$VENV_DIR/bin/activate" + # Install dependencies if needed if ! python3 -c "import fastapi" &> /dev/null; then log_info " Installing Python dependencies..."