blob: a7396947c53d2e826ea7b776d4123fcf90255133 [file] [log] [blame]
#!/bin/bash
# SimExR Framework Setup Script
# This script automates the installation and configuration of the SimExR framework
set -e # Exit on any error
echo "๐Ÿš€ SimExR Framework Setup"
echo "=========================="
# Check if Python is installed
if ! command -v python3 &> /dev/null; then
echo "โŒ Python 3 is not installed. Please install Python 3.8+ first."
exit 1
fi
# Check Python version
PYTHON_VERSION=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
echo "โœ… Python version: $PYTHON_VERSION"
# Create virtual environment
echo "๐Ÿ“ฆ Creating virtual environment..."
if [ -d "simexr_venv" ]; then
echo "โš ๏ธ Virtual environment already exists. Removing..."
rm -rf simexr_venv
fi
python3 -m venv simexr_venv
echo "โœ… Virtual environment created"
# Activate virtual environment
echo "๐Ÿ”ง Activating virtual environment..."
source simexr_venv/bin/activate
# Upgrade pip
echo "โฌ†๏ธ Upgrading pip..."
pip install --upgrade pip
# Install dependencies
echo "๐Ÿ“š Installing dependencies..."
if [ -f "requirements.txt" ]; then
pip install -r requirements.txt
else
echo "โš ๏ธ requirements.txt not found. Installing common dependencies..."
pip install fastapi uvicorn openai pandas numpy scipy matplotlib tqdm sqlalchemy
fi
# Create config directory if it doesn't exist
echo "โš™๏ธ Setting up configuration..."
mkdir -p utils
# Create config file if it doesn't exist
if [ ! -f "utils/config.yaml" ]; then
echo "๐Ÿ“ Creating config.yaml template..."
cat > utils/config.yaml << EOF
# SimExR Configuration
openai:
api_key: "your-openai-api-key-here"
# Database configuration
database:
path: "mcp.db"
# Logging configuration
logging:
level: "INFO"
format: "%(asctime)s | %(levelname)-8s | %(name)-20s | %(message)s"
EOF
echo "โœ… Configuration file created at utils/config.yaml"
echo "โš ๏ธ Please update utils/config.yaml with your OpenAI API key"
else
echo "โœ… Configuration file already exists"
fi
# Create external_models directory
echo "๐Ÿ“ Creating directories..."
mkdir -p external_models
mkdir -p systems/models
mkdir -p logs
# Set up database
echo "๐Ÿ—„๏ธ Setting up database..."
if [ ! -f "mcp.db" ]; then
echo "โœ… Database will be created on first run"
else
echo "โœ… Database already exists"
fi
# Test the installation
echo "๐Ÿงช Testing installation..."
python3 -c "
import sys
print('โœ… Python path:', sys.executable)
try:
import fastapi
print('โœ… FastAPI installed')
except ImportError:
print('โŒ FastAPI not installed')
sys.exit(1)
try:
import openai
print('โœ… OpenAI installed')
except ImportError:
print('โŒ OpenAI not installed')
sys.exit(1)
try:
import pandas
print('โœ… Pandas installed')
except ImportError:
print('โŒ Pandas not installed')
sys.exit(1)
print('โœ… All core dependencies installed successfully')
"
echo ""
echo "๐ŸŽ‰ Setup completed successfully!"
echo ""
echo "๐Ÿ“‹ Next steps:"
echo "1. Update utils/config.yaml with your OpenAI API key"
echo "2. Activate the virtual environment: source simexr_venv/bin/activate"
echo "3. Start the API server: python start_api.py --host 127.0.0.1 --port 8001"
echo "4. Visit http://127.0.0.1:8001/docs for API documentation"
echo ""
echo "๐Ÿ”— Quick start commands:"
echo "source simexr_venv/bin/activate"
echo "python start_api.py --host 127.0.0.1 --port 8001"
echo ""
echo "๐Ÿ“– For more information, see README.md"