ids.alfacom.it/deployment/install_ml_deps.sh
marco370 b78f03392a Update deployment process to handle machine learning dependencies
Create a dedicated script to install machine learning dependencies in the correct order, ensuring Cython is installed before packages that require it for compilation, and update documentation accordingly.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7a657272-55ba-4a79-9a2e-f1ed9bc7a528
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: aa7dc534-7330-4bd4-b726-d6eeb29008af
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/449cf7c4-c97a-45ae-8234-e5c5b8d6a84f/7a657272-55ba-4a79-9a2e-f1ed9bc7a528/2lUhxO2
2025-11-24 16:38:41 +00:00

56 lines
1.6 KiB
Bash

#!/bin/bash
# Script per installare dipendenze ML Hybrid Detector
# Risolve il problema di Cython richiesto come build dependency da eif
set -e
echo "╔═══════════════════════════════════════════════╗"
echo "║ INSTALLAZIONE DIPENDENZE ML HYBRID ║"
echo "╚═══════════════════════════════════════════════╝"
echo ""
# Vai alla directory python_ml
cd "$(dirname "$0")/../python_ml" || exit 1
echo "📍 Directory corrente: $(pwd)"
echo ""
# STEP 1: Installa Cython PRIMA (build dependency per eif)
echo "📦 Step 1/2: Installazione Cython (richiesto per compilare eif)..."
pip install --user Cython==3.0.5
if [ $? -eq 0 ]; then
echo "✅ Cython installato con successo"
else
echo "❌ Errore durante installazione Cython"
exit 1
fi
echo ""
# STEP 2: Installa tutte le altre dipendenze
echo "📦 Step 2/2: Installazione dipendenze ML (xgboost, joblib, eif)..."
pip install --user xgboost==2.0.3 joblib==1.3.2 eif==2.0.2
if [ $? -eq 0 ]; then
echo "✅ Dipendenze ML installate con successo"
else
echo "❌ Errore durante installazione dipendenze ML"
exit 1
fi
echo ""
echo "✅ INSTALLAZIONE COMPLETATA!"
echo ""
echo "🧪 Test import eif..."
python3 -c "from eif import iForest; print('✅ eif importato correttamente')"
if [ $? -eq 0 ]; then
echo ""
echo "✅ TUTTO OK! Hybrid ML Detector pronto per l'uso"
else
echo "❌ Errore durante test import eif"
exit 1
fi