# Fix Python Import Warnings
# Run from project root
Write-Host "๐ง Fixing Python Import Warnings" -ForegroundColor Cyan
Write-Host ""
# Check if in virtual environment
$inVenv = $env:VIRTUAL_ENV -ne $null
if (-not $inVenv) {
Write-Host "โ ๏ธ Not in virtual environment!" -ForegroundColor Yellow
Write-Host "Activating virtual environment..." -ForegroundColor Yellow
if (Test-Path "backend\venv\Scripts\Activate.ps1") {
& "backend\venv\Scripts\Activate.ps1"
Write-Host "โ
Virtual environment activated" -ForegroundColor Green
} else {
Write-Host "โ Virtual environment not found!" -ForegroundColor Red
Write-Host "Run: python -m venv backend\venv" -ForegroundColor Yellow
exit 1
}
}
# Install/upgrade dependencies
Write-Host ""
Write-Host "๐ฆ Installing Python dependencies..." -ForegroundColor Cyan
Push-Location backend
try {
# Upgrade pip
python -m pip install --upgrade pip --quiet
# Install all dependencies
pip install -r requirements.txt --quiet
# Install test dependencies
pip install pytest pytest-asyncio pytest-cov httpx --quiet
Write-Host "โ
All dependencies installed" -ForegroundColor Green
} catch {
Write-Host "โ Installation failed: $_" -ForegroundColor Red
exit 1
} finally {
Pop-Location
}
Write-Host ""
Write-Host "๐ Verifying installations..." -ForegroundColor Cyan
$packages = @("fastapi", "uvicorn", "pydantic", "pytest", "google-generativeai")
foreach ($pkg in $packages) {
$check = pip show $pkg 2>$null
if ($check) {
Write-Host "โ
$pkg" -ForegroundColor Green
} else {
Write-Host "โ $pkg - NOT FOUND" -ForegroundColor Red
}
}
Write-Host ""
Write-Host "โ
Setup complete!" -ForegroundColor Green
Write-Host ""
Write-Host "Note: Pylance warnings are normal and don't affect functionality." -ForegroundColor Yellow
Write-Host "To remove them, restart VS Code after running this script." -ForegroundColor Yellow
Write-Host ""