# Installation Script Guide
The MCP Presidio installation script (`install.py`) provides an interactive way to install the project and its dependencies.
## Quick Start
**Unix/Linux/macOS:**
```bash
./install.sh
```
**Windows:**
```cmd
install.bat
```
**Direct Python:**
```bash
python install.py
```
## Features
### Automatic Dependency Installation
- Checks Python version (3.10+ required)
- Installs base dependencies: mcp, presidio-analyzer, presidio-anonymizer, spacy
- Skips reinstallation if packages are already present (with option to override)
### Interactive Language Model Selection
Choose which spaCy language models to install:
- **English (en_core_web_lg)** - Required for optimal performance
- **Spanish (es_core_news_lg)** - Optional
- **French (fr_core_news_lg)** - Optional
- **German (de_core_news_lg)** - Optional
- **Italian (it_core_news_lg)** - Optional
- **Portuguese (pt_core_news_lg)** - Optional
Options:
- `a` - Install all language models
- `r` - Install required models only (English)
- `n` - Skip language model installation (limited accuracy)
- `1,2,3` - Install specific models by number (comma-separated)
### Optional Development Dependencies
Choose whether to install development tools:
- pytest
- pytest-asyncio
### Verification and Testing
- Verifies all dependencies are installed correctly
- Checks for language models
- Optionally runs a basic PII detection test
## Usage Examples
### Install with English model only (fastest)
```bash
python install.py
# When prompted, choose 'r' for required models
```
### Install with all language models
```bash
python install.py
# When prompted, choose 'a' for all models
```
### Install specific language models
```bash
python install.py
# When prompted, enter: 1,2,4
# This installs English, Spanish, and German
```
### Skip language models (minimal install)
```bash
python install.py
# When prompted, choose 'n' to skip
# Note: This will reduce accuracy
```
### Non-interactive install (for CI/CD)
```bash
# Install base + required models
echo -e "n\nr\nn\nn" | python install.py
# Install base + all models
echo -e "n\na\nn\nn" | python install.py
# Minimal install (no models)
echo -e "n\nn\nn\nn" | python install.py
```
## What the Script Does
1. **Python Version Check**
- Verifies Python 3.10 or higher
- Displays current Python version
2. **Base Dependencies**
- Runs `pip install -e .`
- Installs mcp, presidio-analyzer, presidio-anonymizer, spacy
- Checks if already installed before reinstalling
3. **Language Models**
- Lists available spaCy models with installation status
- Downloads selected models using `python -m spacy download`
- Shows progress for each model
4. **Optional Dependencies**
- Prompts for development tools
- Installs pytest and pytest-asyncio if requested
5. **Verification**
- Checks each package is importable
- Verifies at least one language model is available
- Reports any missing components
6. **Testing**
- Optionally runs a basic PII detection test
- Tests with example text: "My email is test@example.com"
- Shows detected entities
7. **Next Steps**
- Displays helpful information about using the server
- Shows documentation links
- Provides example commands
## Troubleshooting
### Python Version Error
```
❌ Python 3.10 or higher is required
```
**Solution:** Install Python 3.10 or higher from python.org
### Package Installation Fails
```
❌ Failed to install base dependencies
```
**Solution:**
- Check internet connection
- Try: `pip install --upgrade pip`
- Manually install: `pip install -e .`
### Language Model Download Fails
```
⚠️ Failed to install English model
```
**Solution:**
- Check internet connection
- Try manually: `python -m spacy download en_core_web_lg`
- See: https://spacy.io/usage/models
### Import Errors After Installation
**Solution:**
- Ensure you're in the correct virtual environment
- Try: `pip install --force-reinstall -e .`
- Check: `pip list | grep presidio`
### No Language Models Installed
```
⚠️ No spaCy language models found - limited accuracy expected
```
**Solution:** Install at least the English model:
```bash
python -m spacy download en_core_web_lg
```
## Script Output
The script uses emojis and colors for easy reading:
- ✅ Success - Action completed successfully
- ℹ️ Info - Informational message
- ⚠️ Warning - Non-critical issue
- ❌ Error - Critical error
## Environment Variables
The script respects standard Python/pip environment variables:
- `VIRTUAL_ENV` - Active virtual environment
- `PIP_INDEX_URL` - Custom PyPI mirror
- `PIP_TRUSTED_HOST` - Trusted hosts for pip
## Advanced Options
### Skip Prompts (Automated Installation)
For automated/CI installations, pipe responses:
```bash
# Format: base_reinstall | models | dev_deps | test
echo -e "n\nr\nn\nn" | python install.py
```
### Custom Installation Directory
```bash
# Install in specific directory
cd /path/to/install/location
python /path/to/mcp-presidio/install.py
```
### Install Behind Proxy
```bash
# Set proxy for pip
export HTTP_PROXY=http://proxy.example.com:8080
export HTTPS_PROXY=http://proxy.example.com:8080
python install.py
```
## Files Created
The script does not create new files, but modifies:
- Python package installation in site-packages
- spaCy model files in spaCy data directory
- pip metadata
## Uninstallation
To uninstall:
```bash
# Uninstall package
pip uninstall mcp-presidio
# Uninstall dependencies (optional)
pip uninstall mcp presidio-analyzer presidio-anonymizer spacy
# Remove spaCy models (optional)
python -m spacy info # Lists installed models
# Then manually remove from spaCy data directory
```
## Support
For issues with the installation script:
- Check this guide first
- See README.md for manual installation
- Open an issue on GitHub with error output