Fixes for Linux https://github.com/BeehiveInnovations/zen-mcp-server/issues/84
This commit is contained in:
@@ -14,7 +14,7 @@ import os
|
|||||||
# These values are used in server responses and for tracking releases
|
# These values are used in server responses and for tracking releases
|
||||||
# IMPORTANT: This is the single source of truth for version and author info
|
# IMPORTANT: This is the single source of truth for version and author info
|
||||||
# Semantic versioning: MAJOR.MINOR.PATCH
|
# Semantic versioning: MAJOR.MINOR.PATCH
|
||||||
__version__ = "5.2.0"
|
__version__ = "5.2.1"
|
||||||
# Last update date in ISO format
|
# Last update date in ISO format
|
||||||
__updated__ = "2025-06-19"
|
__updated__ = "2025-06-19"
|
||||||
# Primary maintainer
|
# Primary maintainer
|
||||||
|
|||||||
@@ -213,11 +213,76 @@ setup_venv() {
|
|||||||
# Create venv if it doesn't exist
|
# Create venv if it doesn't exist
|
||||||
if [[ ! -d "$VENV_PATH" ]]; then
|
if [[ ! -d "$VENV_PATH" ]]; then
|
||||||
print_info "Creating isolated environment..."
|
print_info "Creating isolated environment..."
|
||||||
if $python_cmd -m venv "$VENV_PATH" 2>/dev/null; then
|
|
||||||
|
# Capture error output for better diagnostics
|
||||||
|
local venv_error
|
||||||
|
if venv_error=$($python_cmd -m venv "$VENV_PATH" 2>&1); then
|
||||||
print_success "Created isolated environment"
|
print_success "Created isolated environment"
|
||||||
else
|
else
|
||||||
print_error "Failed to create virtual environment"
|
print_error "Failed to create virtual environment"
|
||||||
exit 1
|
echo ""
|
||||||
|
echo "Error details:"
|
||||||
|
echo "$venv_error"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Check for common Linux issues and try fallbacks
|
||||||
|
local os_type=$(detect_os)
|
||||||
|
if [[ "$os_type" == "linux" || "$os_type" == "wsl" ]]; then
|
||||||
|
if echo "$venv_error" | grep -E -q "No module named venv|venv.*not found"; then
|
||||||
|
print_warning "Python venv module not available, trying fallback methods..."
|
||||||
|
|
||||||
|
# Try virtualenv as fallback
|
||||||
|
if command -v virtualenv &> /dev/null; then
|
||||||
|
print_info "Attempting to create environment with virtualenv..."
|
||||||
|
local fallback_error
|
||||||
|
if fallback_error=$(virtualenv -p "$python_cmd" "$VENV_PATH" 2>&1); then
|
||||||
|
print_success "Created environment using virtualenv fallback"
|
||||||
|
# Continue to path setup below instead of early return
|
||||||
|
else
|
||||||
|
echo "virtualenv fallback failed: $fallback_error"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Try python -m virtualenv if directory wasn't created
|
||||||
|
if [[ ! -d "$VENV_PATH" ]]; then
|
||||||
|
local fallback_error
|
||||||
|
if fallback_error=$($python_cmd -m virtualenv "$VENV_PATH" 2>&1); then
|
||||||
|
print_success "Created environment using python -m virtualenv fallback"
|
||||||
|
# Continue to path setup below instead of early return
|
||||||
|
else
|
||||||
|
echo "python -m virtualenv fallback failed: $fallback_error"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if any fallback succeeded
|
||||||
|
if [[ ! -d "$VENV_PATH" ]]; then
|
||||||
|
print_error "All virtual environment creation methods failed!"
|
||||||
|
echo ""
|
||||||
|
echo "Please install the venv or virtualenv package:"
|
||||||
|
echo " Ubuntu/Debian: sudo apt install python3-venv python3-virtualenv"
|
||||||
|
echo " RHEL/CentOS: sudo dnf install python3-venv python3-virtualenv"
|
||||||
|
echo " Fedora: sudo dnf install python3-venv python3-virtualenv"
|
||||||
|
echo " Arch: sudo pacman -S python-virtualenv"
|
||||||
|
echo ""
|
||||||
|
echo "Or install via pip:"
|
||||||
|
echo " $python_cmd -m pip install --user virtualenv"
|
||||||
|
echo ""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
elif echo "$venv_error" | grep -q "Permission denied"; then
|
||||||
|
print_error "Permission denied creating virtual environment"
|
||||||
|
echo ""
|
||||||
|
echo "Try running with different permissions or in a different directory:"
|
||||||
|
echo " mkdir -p ~/zen-mcp-temp && cd ~/zen-mcp-temp"
|
||||||
|
echo " git clone <repository-url> && cd zen-mcp-server && ./run-server.sh"
|
||||||
|
echo ""
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user