# Prerequisites check script for Ragflow PDF Preprocessing Write-Host "======================================================" -ForegroundColor Cyan Write-Host " Ragflow PDF Preprocessing Prerequisites Check" -ForegroundColor Cyan Write-Host "======================================================" -ForegroundColor Cyan Write-Host "" $allOk = $true # Check Python and version try { $pythonVersionOutput = (python --version) 2>&1 $pythonVersion = $pythonVersionOutput -replace "Python " if ([version]$pythonVersion -ge [version]"3.8") { Write-Host "✅ Python $pythonVersion is installed (>= 3.8 required)" -ForegroundColor Green } else { Write-Host "❌ Python $pythonVersion is installed, but version 3.8 or higher is required" -ForegroundColor Red $allOk = $false } } catch { Write-Host "❌ Python is not installed or not in PATH" -ForegroundColor Red Write-Host " Required installation: https://www.python.org/downloads/" -ForegroundColor Yellow Write-Host " Make sure to check 'Add Python to PATH' during installation" -ForegroundColor Yellow $allOk = $false } # Check Tesseract OCR $tesseractPaths = @( "C:\Program Files\Tesseract-OCR\tesseract.exe", "C:\Program Files (x86)\Tesseract-OCR\tesseract.exe", "C:\Tesseract-OCR\tesseract.exe" ) $tesseractInstalled = $false $tesseractPath = "" foreach ($path in $tesseractPaths) { if (Test-Path $path) { $tesseractInstalled = $true $tesseractPath = $path break } } if ($tesseractInstalled) { Write-Host "✅ Tesseract OCR is installed at: $tesseractPath" -ForegroundColor Green # Check language packs $tesseractDir = Split-Path -Parent $tesseractPath $langPath = Join-Path $tesseractDir "tessdata" $fraLangPath = Join-Path $langPath "fra.traineddata" $engLangPath = Join-Path $langPath "eng.traineddata" if (Test-Path $fraLangPath) { Write-Host " ✅ French language pack (fra) installed" -ForegroundColor Green } else { Write-Host " ❌ French language pack (fra) missing" -ForegroundColor Yellow Write-Host " Reinstall Tesseract selecting the language packs" -ForegroundColor Yellow $allOk = $false } if (Test-Path $engLangPath) { Write-Host " ✅ English language pack (eng) installed" -ForegroundColor Green } else { Write-Host " ❌ English language pack (eng) missing" -ForegroundColor Yellow Write-Host " Reinstall Tesseract selecting the language packs" -ForegroundColor Yellow $allOk = $false } } else { Write-Host "❌ Tesseract OCR is not installed" -ForegroundColor Red Write-Host " Required installation: https://github.com/UB-Mannheim/tesseract/wiki" -ForegroundColor Yellow Write-Host " Make sure to select French and English language packs" -ForegroundColor Yellow $allOk = $false } # Check Ollama server try { $response = Invoke-WebRequest -Uri "http://217.182.105.173:11434/api/version" -UseBasicParsing -ErrorAction SilentlyContinue if ($response.StatusCode -eq 200) { Write-Host "✅ Ollama server is accessible at 217.182.105.173:11434" -ForegroundColor Green # Check available models $modelsResponse = Invoke-WebRequest -Uri "http://217.182.105.173:11434/api/tags" -UseBasicParsing -ErrorAction SilentlyContinue $models = ($modelsResponse.Content | ConvertFrom-Json).models $modelNames = $models | ForEach-Object { $_.name } # Required models based on the server's available models $requiredModels = @( "mistral:latest", "llava:34b-v1.6-fp16", "llama3.2-vision:90b-instruct-q8_0" ) foreach ($model in $requiredModels) { if ($modelNames -contains $model) { Write-Host " ✅ Model $model is available" -ForegroundColor Green } else { Write-Host " ❌ Model $model not found on server" -ForegroundColor Yellow Write-Host " This model is required for some features" -ForegroundColor Yellow $allOk = $false } } } } catch { Write-Host "❌ Cannot connect to Ollama server at 217.182.105.173:11434" -ForegroundColor Red Write-Host " Make sure you have network connectivity to the Ollama server" -ForegroundColor Yellow Write-Host " This is required for the LLM features of the application" -ForegroundColor Yellow $allOk = $false } # Check Python libraries Write-Host "" Write-Host "Checking required Python libraries:" -ForegroundColor Cyan $requiredLibraries = @( "PyQt6", "PyMuPDF", "numpy", "pytesseract", "Pillow", "opencv-python", "requests" ) foreach ($lib in $requiredLibraries) { try { $output = python -c "import $($lib.ToLower().Replace('-', '_')); print('OK')" 2>&1 if ($output -eq "OK") { Write-Host " ✅ $lib is installed" -ForegroundColor Green } else { Write-Host " ❌ $lib is not installed correctly" -ForegroundColor Red Write-Host " Recommended installation: pip install $lib" -ForegroundColor Yellow $allOk = $false } } catch { Write-Host " ❌ $lib is not installed" -ForegroundColor Red Write-Host " Recommended installation: pip install $lib" -ForegroundColor Yellow $allOk = $false } } # Summary Write-Host "" Write-Host "======================================================" -ForegroundColor Cyan if ($allOk) { Write-Host "✅ All prerequisites are satisfied!" -ForegroundColor Green Write-Host " You can proceed with the installation and use of Ragflow." -ForegroundColor Green } else { Write-Host "⚠️ Some prerequisites are not satisfied." -ForegroundColor Yellow Write-Host " Please install the missing components before using Ragflow." -ForegroundColor Yellow } Write-Host "======================================================" -ForegroundColor Cyan Read-Host "Press ENTER to exit"