fix: add Python 3.10+ version check to setup scripts
- 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 <noreply@anthropic.com>
This commit is contained in:
19
README.md
19
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:
|
||||
|
||||
25
setup.bat
25
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
|
||||
|
||||
18
setup.sh
18
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"
|
||||
|
||||
Reference in New Issue
Block a user