Files

43 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Setup Python venv for single-machine x86_64 Intel OpenVINO deployment (ZenAI APC Ngoro)
set -euo pipefail
INSTALL_DIR="${INSTALL_DIR:-/home/admin123/ngoro_project}"
cd "$INSTALL_DIR"
if [ ! -f requirements.txt ]; then
echo "ERROR: requirements.txt not found in $INSTALL_DIR"
exit 1
fi
echo "Checking system prerequisites (ffmpeg, Intel OpenCL ICD)..."
for bin in ffmpeg ffprobe; do
if ! command -v "$bin" >/dev/null 2>&1; then
echo "WARNING: $bin not found. Install with: sudo apt-get update && sudo apt-get install -y ffmpeg intel-opencl-icd ocl-icd-libopencl1"
fi
done
UV_BIN="$(command -v uv || true)"
if [ -z "$UV_BIN" ] && [ -x "$HOME/.local/bin/uv" ]; then
UV_BIN="$HOME/.local/bin/uv"
fi
if [ -n "$UV_BIN" ]; then
echo "Creating clean Python virtual environment via uv in $INSTALL_DIR/venv..."
"$UV_BIN" venv --seed --clear "$INSTALL_DIR/venv"
echo "Installing Python dependencies via uv..."
"$UV_BIN" pip install --python "$INSTALL_DIR/venv/bin/python" -r requirements.txt
else
echo "Creating clean Python virtual environment in $INSTALL_DIR/venv..."
python3 -m venv venv
echo "Installing Python dependencies..."
PYTHONNOUSERSITE=1 venv/bin/pip install --upgrade pip
PYTHONNOUSERSITE=1 venv/bin/pip install -r requirements.txt
fi
echo "Creating local video directories..."
mkdir -p "$INSTALL_DIR/batch_videos" "$INSTALL_DIR/recount_output"
echo "Done. Activate with: source $INSTALL_DIR/venv/bin/activate"
echo "Remember to ensure user is in render/video groups for GPU/NPU access: sudo usermod -aG render,video \$USER"