Files
stt-server/setup-venv.sh
2026-06-07 08:47:03 +00:00

32 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# setup-venv.sh — installs faster-whisper from PyPI into a venv.
#
# USE THIS SCRIPT when the PyPI ctranslate2 wheel matches your CUDA version.
# PyPI wheels target a specific CUDA major version; if your system matches,
# this is the fastest way to get started — no compilation required.
#
# If you see errors like "libcublas.so.12: cannot open shared object file" at
# runtime, your CUDA version does not match the wheel. Use setup-venv-local-build.sh
# instead, which compiles ctranslate2 against your actual CUDA installation.
#
# Environment overrides:
# PYTHON_ENV path to venv (default: ./venv)
#
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VENV="${PYTHON_ENV:-${SCRIPT_DIR}/venv}"
if [ ! -d "${VENV}" ]; then
echo "==> creating venv at ${VENV}"
python3 -m venv "${VENV}"
fi
echo "==> installing torch and faster-whisper"
"${VENV}/bin/pip" install --upgrade pip --quiet
"${VENV}/bin/pip" install torch faster-whisper
echo ""
echo "==> done. Venv ready at ${VENV}"