Add ability to install ML dependencies and resolve build issues

Update install_ml_deps.sh to use --no-build-isolation when installing eif to resolve ModuleNotFoundError during build.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7a657272-55ba-4a79-9a2e-f1ed9bc7a528
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: 219383e3-8935-415d-8c84-77e7d6f76af8
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/449cf7c4-c97a-45ae-8234-e5c5b8d6a84f/7a657272-55ba-4a79-9a2e-f1ed9bc7a528/2lUhxO2
This commit is contained in:
marco370 2025-11-24 17:06:43 +00:00
parent 485f3d983b
commit 051c838840
2 changed files with 62 additions and 1 deletions

View File

@ -0,0 +1,60 @@
./deployment/install_ml_deps.sh
╔═══════════════════════════════════════════════╗
║ INSTALLAZIONE DIPENDENZE ML HYBRID ║
╚═══════════════════════════════════════════════╝
 Directory corrente: /opt/ids/python_ml
 Attivazione virtual environment...
 Python in uso: /opt/ids/python_ml/venv/bin/python
📦 Step 1/3: Installazione build dependencies (Cython + numpy)...
Collecting Cython==3.0.5
Downloading Cython-3.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.2 kB)
Downloading Cython-3.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.6/3.6 MB 59.8 MB/s 0:00:00
Installing collected packages: Cython
Successfully installed Cython-3.0.5
✅ Cython installato con successo
📦 Step 2/3: Verifica numpy disponibile...
✅ numpy 1.26.2 già installato
📦 Step 3/3: Installazione dipendenze ML (xgboost, joblib, eif)...
Collecting xgboost==2.0.3
Downloading xgboost-2.0.3-py3-none-manylinux2014_x86_64.whl.metadata (2.0 kB)
Requirement already satisfied: joblib==1.3.2 in ./venv/lib64/python3.11/site-packages (1.3.2)
Collecting eif==2.0.2
Downloading eif-2.0.2.tar.gz (1.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 6.7 MB/s 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [20 lines of output]
Traceback (most recent call last):
File "/opt/ids/python_ml/venv/lib64/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
main()
File "/opt/ids/python_ml/venv/lib64/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
json_out["return_val"] = hook(**hook_input["kwargs"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/ids/python_ml/venv/lib64/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 143, in get_requires_for_build_wheel
return hook(config_settings)
^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-9buits4u/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 331, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-9buits4u/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-9buits4u/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 512, in run_setup
super().run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-9buits4u/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 317, in run_setup
exec(code, locals())
File "<string>", line 3, in <module>
ModuleNotFoundError: No module named 'numpy'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed to build 'eif' when getting requirements to build wheel

View File

@ -62,7 +62,8 @@ echo ""
# STEP 3: Installa dipendenze ML (ora Cython e numpy sono disponibili)
echo "📦 Step 3/3: Installazione dipendenze ML (xgboost, joblib, eif)..."
pip install xgboost==2.0.3 joblib==1.3.2 eif==2.0.2
pip install xgboost==2.0.3 joblib==1.3.2
pip install --no-build-isolation eif==2.0.2
if [ $? -eq 0 ]; then
echo "✅ Dipendenze ML installate con successo"