File size: 1,398 Bytes
9b205e1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash

set -e

# Function for logging
log() {
    echo "[$(date '+%Y-%m-%d %H:%M:%S')] [PERSISTENCE] $*"
}

# Function for cleanup
cleanup() {
    log "Performing persistence installation cleanup..."
    rm -rf \
        /var/lib/apt/lists/* \
        /var/tmp/* \
        /var/log/*
}

# Trap to ensure cleanup on exit
trap cleanup EXIT

log "Starting persistence service dependencies installation..."

log "Updating package lists..."
apt-get update

log "Installing Python environment for persistence service..."
apt-get install -y --no-install-recommends \
    python3 \
    python3-pip \
    python3-venv

log "Installing Python packages for Hugging Face integration..."
pip3 install --no-cache-dir --break-system-packages huggingface_hub

log "Verifying Python installation..."
if command -v python3 >/dev/null 2>&1; then
    PYTHON_VERSION=$(python3 --version 2>&1 || echo "Version check failed")
    log "Python installed successfully: ${PYTHON_VERSION}"
else
    log "ERROR: Python installation failed"
    exit 1
fi

log "Verifying huggingface_hub installation..."
if python3 -c "import huggingface_hub; print('huggingface_hub version:', huggingface_hub.__version__)" 2>/dev/null; then
    log "huggingface_hub installed successfully"
else
    log "ERROR: huggingface_hub installation failed"
    exit 1
fi

log "Persistence service dependencies installation completed successfully"