From de04ed0312d3ee089778f0e6fa08034a7f1cff6a Mon Sep 17 00:00:00 2001 From: Fahad Date: Mon, 9 Jun 2025 20:47:11 +0400 Subject: [PATCH] fix: add Python 3.10+ version check to setup scripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add Python version validation in setup.sh and setup.bat - Require Python 3.10 or higher (needed by mcp package) - Provide clear error messages with upgrade instructions - Update README prerequisites and troubleshooting sections This prevents confusing dependency errors when users have older Python versions. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- README.md | 19 ++++++++++++++----- setup.bat | 25 +++++++++++++++++++++++++ setup.sh | 18 ++++++++++++++++++ 3 files changed, 57 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 54d759b..4cc76d5 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,10 @@ All tools accept both individual files and entire directories. The server: ## Quickstart (5 minutes) +### Prerequisites +- **Python 3.10 or higher** (required by the `mcp` package) +- Git + ### 1. Get a Gemini API Key Visit [Google AI Studio](https://makersuite.google.com/app/apikey) and generate an API key. For best results with Gemini 2.5 Pro, use a paid API key as the free tier has limited access to the latest models. @@ -890,11 +894,16 @@ This error occurs when Claude Desktop (running on Windows) can't properly execut ### Common Issues -**"ModuleNotFoundError: No module named 'mcp'"** -- This means Python dependencies aren't installed -- **Solution**: Run the setup script: - - macOS/Linux: `./setup.sh` - - Windows: `setup.bat` +**"ModuleNotFoundError: No module named 'mcp'" or "No matching distribution found for mcp"** +- This means either: + 1. Python dependencies aren't installed - run the setup script + 2. Your Python version is too old - the `mcp` package requires Python 3.10+ +- **Solution**: + - First check your Python version: `python3 --version` or `python --version` + - If below 3.10, upgrade Python from https://python.org + - Then run the setup script: + - macOS/Linux: `./setup.sh` + - Windows: `setup.bat` - If you still see this error, manually activate the virtual environment and install: ```bash # macOS/Linux: diff --git a/setup.bat b/setup.bat index 3f5d663..bebde2b 100644 --- a/setup.bat +++ b/setup.bat @@ -22,6 +22,31 @@ REM Display Python version echo Found Python: python --version +REM Check Python version is at least 3.10 +for /f "tokens=2 delims= " %%i in ('python --version 2^>^&1') do set PYTHON_VERSION=%%i +for /f "tokens=1,2 delims=." %%a in ("%PYTHON_VERSION%") do ( + set PYTHON_MAJOR=%%a + set PYTHON_MINOR=%%b +) + +if %PYTHON_MAJOR% LSS 3 ( + goto :pythonTooOld +) +if %PYTHON_MAJOR% EQU 3 if %PYTHON_MINOR% LSS 10 ( + goto :pythonTooOld +) +goto :pythonOk + +:pythonTooOld +echo Error: Python 3.10 or higher is required (you have Python %PYTHON_VERSION%) +echo. +echo The 'mcp' package requires Python 3.10 or newer. +echo Please download and install Python from https://python.org +echo Make sure to check "Add Python to PATH" during installation. +exit /b 1 + +:pythonOk + REM Check if venv exists if exist "venv\" ( echo Virtual environment already exists diff --git a/setup.sh b/setup.sh index 349a2a2..8ea873d 100755 --- a/setup.sh +++ b/setup.sh @@ -21,6 +21,24 @@ fi PYTHON_VERSION=$(python3 --version) echo "✓ Found $PYTHON_VERSION" +# Check Python version is at least 3.10 +PYTHON_VERSION_MAJOR=$(python3 -c 'import sys; print(sys.version_info.major)') +PYTHON_VERSION_MINOR=$(python3 -c 'import sys; print(sys.version_info.minor)') + +if [ "$PYTHON_VERSION_MAJOR" -lt 3 ] || ([ "$PYTHON_VERSION_MAJOR" -eq 3 ] && [ "$PYTHON_VERSION_MINOR" -lt 10 ]); then + echo "❌ Error: Python 3.10 or higher is required (you have Python $PYTHON_VERSION_MAJOR.$PYTHON_VERSION_MINOR)" + echo "" + echo "The 'mcp' package requires Python 3.10 or newer." + echo "Please upgrade Python from https://python.org" + echo "" + echo "On macOS with Homebrew:" + echo " brew install python@3.12" + echo "" + echo "On Ubuntu/Debian:" + echo " sudo apt update && sudo apt install python3.12 python3.12-venv" + exit 1 +fi + # Check if venv exists if [ -d "venv" ]; then echo "✓ Virtual environment already exists"