# FastAPI Installation Guide

## Current Status
✅ **FastAPI is already installed!**
- Version: 0.116.1
- Python: 3.10.12
- Location: System-wide installation

## Installation Options

### Option 1: Install FastAPI Only
```bash
python3 -m pip install fastapi
```

### Option 2: Install FastAPI with Uvicorn (ASGI server)
```bash
python3 -m pip install fastapi uvicorn
```

### Option 3: Install All Dependencies from requirements.txt
```bash
cd /var/www/html/live_calls/homebook
python3 -m pip install -r requirements.txt
```

### Option 4: Install in Virtual Environment (Recommended for Production)
```bash
# Create virtual environment
cd /var/www/html/live_calls/homebook
python3 -m venv venv

# Activate virtual environment
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# To use: Always activate venv before running
source venv/bin/activate
python main.py
```

### Option 5: Upgrade FastAPI to Latest Version
```bash
python3 -m pip install --upgrade fastapi
```

## Verify Installation

```bash
# Check FastAPI version
python3 -c "import fastapi; print('FastAPI version:', fastapi.__version__)"

# Check if uvicorn is installed
python3 -c "import uvicorn; print('Uvicorn version:', uvicorn.__version__)"

# List all installed packages
python3 -m pip list | grep -E "(fastapi|uvicorn|starlette|pydantic)"
```

## Run the Application

```bash
cd /var/www/html/live_calls/homebook

# Method 1: Using Python directly
python3 main.py

# Method 2: Using uvicorn directly
uvicorn main:app --host 0.0.0.0 --port 7900

# Method 3: Using uvicorn with reload (development)
uvicorn main:app --host 0.0.0.0 --port 7900 --reload
```

## Dependencies Already in requirements.txt

Your `requirements.txt` includes:
- `fastapi==0.116.1` ✅
- `uvicorn==0.35.0` ✅ (ASGI server)
- `starlette==0.47.3` ✅ (FastAPI dependency)
- `pydantic==2.11.7` ✅ (FastAPI dependency)
- All other required packages

## Quick Install All Dependencies

If you want to ensure all dependencies are installed:

```bash
cd /var/www/html/live_calls/homebook
python3 -m pip install -r requirements.txt
```

This will install:
- FastAPI and all its dependencies
- Uvicorn (ASGI server)
- WebSocket support
- Database connectors
- Audio processing libraries
- And all other dependencies

## Troubleshooting

### If you get permission errors:
```bash
# Use --user flag
python3 -m pip install --user fastapi

# Or use sudo (not recommended)
sudo python3 -m pip install fastapi
```

### If you need to reinstall:
```bash
python3 -m pip uninstall fastapi
python3 -m pip install fastapi
```

### Check installation location:
```bash
python3 -m pip show fastapi
```

