Fix setup.sh venv detection on fresh Debian installs

- Check for venv/bin/activate file instead of just venv directory
- Add error handling when python3-venv package is not installed
- Clean up incomplete venv directories from failed attempts
- Provide helpful instructions to install python3-venv

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Smittix
2026-01-05 13:24:49 +00:00
parent 1f2a7ee523
commit f7ccd56ec0
+17 -2
View File
@@ -81,7 +81,7 @@ install_python_deps() {
if [ -n "$VIRTUAL_ENV" ]; then
echo "Using virtual environment: $VIRTUAL_ENV"
pip install -r requirements.txt
elif [ -d "venv" ]; then
elif [ -f "venv/bin/activate" ]; then
echo "Found existing venv, activating..."
source venv/bin/activate
pip install -r requirements.txt
@@ -97,7 +97,22 @@ install_python_deps() {
echo ""
echo -e "${YELLOW}System Python is externally managed (PEP 668).${NC}"
echo "Creating virtual environment..."
python3 -m venv venv
# Remove any incomplete venv directory from previous failed attempts
if [ -d "venv" ] && [ ! -f "venv/bin/activate" ]; then
echo "Removing incomplete venv directory..."
rm -rf venv
fi
if ! python3 -m venv venv; then
echo -e "${RED}Error: Failed to create virtual environment${NC}"
echo ""
echo "On Debian/Ubuntu, install the venv module with:"
echo " sudo apt install python3-venv"
echo ""
echo "Then run this setup script again."
exit 1
fi
source venv/bin/activate
pip install -r requirements.txt
echo ""