diff --git a/chamber b/chamber index a317643..488e75d 100755 --- a/chamber +++ b/chamber @@ -12,7 +12,7 @@ set -euo pipefail cd "$(dirname "$0")" -PORT="${CHAMBER_PORT:-8000}" +PORT="${CHAMBER_PORT:-8484}" HOST="${CHAMBER_HOST:-127.0.0.1}" DEVICE="auto" @@ -31,20 +31,34 @@ PIDFILE=".chamber.pid" have_nvidia() { command -v nvidia-smi >/dev/null 2>&1 && nvidia-smi -L >/dev/null 2>&1; } +pip_into() { + if command -v uv >/dev/null 2>&1; then + uv pip install --quiet --python .venv/bin/python "$@" + else + .venv/bin/pip install --quiet "$@" + fi +} + install_venv() { if [[ ! -x .venv/bin/python ]]; then - python3 -m venv .venv + # torch has no wheels for bleeding-edge pythons; prefer uv-pinned 3.12 + if command -v uv >/dev/null 2>&1; then + echo "[chamber] uv found -> venv with python 3.12" + uv venv --python 3.12 .venv + else + python3 -m venv .venv + fi echo "[chamber] venv created" fi if have_nvidia && [[ "$DEVICE" != "cpu" ]]; then echo "[chamber] NVIDIA detected -> installing CUDA torch (big download)" - .venv/bin/pip install --quiet "torch" --index-url https://download.pytorch.org/whl/cu121 + pip_into "torch" --index-url https://download.pytorch.org/whl/cu126 else echo "[chamber] CPU mode -> installing CPU torch" - .venv/bin/pip install --quiet "torch" --index-url https://download.pytorch.org/whl/cpu + pip_into "torch" --index-url https://download.pytorch.org/whl/cpu fi # requirements.txt pins cpu-index torch on its own line; install the rest - grep -v '^torch' live/requirements.txt | .venv/bin/pip install --quiet -r /dev/stdin + grep -v '^torch' live/requirements.txt | pip_into -r /dev/stdin echo "[chamber] deps installed" }