- setup.sh is executable in the repository (a fresh clone could not run `./setup.sh`: Permission denied). - setup.sh: Debian/Ubuntu ship Python's venv without ensurepip (the separate python3-venv package); the check now needs both, so it installs python3-venv instead of failing to create .venv - and a .venv left without pip by a failed run is made again. - Linux: physical_cores() keeps one allowed CPU per (package, core) from sysfs, like the Windows branch; SMT siblings no longer get their own pool worker (issue #40: 23 -> 15 workers on a 13700K, +16% decode). - START-HERE / setup.sh `--port N` now applies to an existing install; without it the install's own port is kept (issue #32). - Monitor: the server keeps the last 500 requests and totals since it started; the Monitor shows the totals and a "Show all" toggle (`/metrics?requests=all`), 12 rows otherwise (issue #35).
39 lines
1.8 KiB
Bash
Executable File
39 lines
1.8 KiB
Bash
Executable File
#!/bin/sh
|
|
# Strata for Linux: the first run installs everything and starts the model; later runs just start it.
|
|
# Needs only an NVIDIA driver. Python (with venv) is installed through apt/dnf if it is missing (asks for sudo).
|
|
cd "$(dirname "$0")" || exit 1
|
|
# Python 3.10+ that can make a venv WITH pip: Debian/Ubuntu ship `venv` without `ensurepip` (that is the separate
|
|
# python3-venv package), and a venv made without it has no pip
|
|
ok_py() { "$1" -c 'import sys, venv, ensurepip; sys.exit(0 if sys.version_info >= (3, 10) else 1)' 2>/dev/null; }
|
|
# a .venv from an earlier run that failed half-way has a python but no pip: start it again
|
|
if [ -x .venv/bin/python ] && ! .venv/bin/python -m pip --version >/dev/null 2>&1; then
|
|
rm -rf .venv
|
|
fi
|
|
if [ ! -x .venv/bin/python ]; then
|
|
PY=""
|
|
for c in python3 python; do
|
|
if command -v $c >/dev/null 2>&1 && ok_py $c; then
|
|
PY=$c; break
|
|
fi
|
|
done
|
|
if [ -z "$PY" ]; then
|
|
echo "Python 3.10+ with venv is needed; installing it (sudo will ask for your password) ..."
|
|
if command -v apt-get >/dev/null 2>&1; then
|
|
sudo apt-get update && sudo apt-get install -y python3 python3-venv python3-pip
|
|
elif command -v dnf >/dev/null 2>&1; then
|
|
sudo dnf install -y python3 python3-pip
|
|
elif command -v pacman >/dev/null 2>&1; then
|
|
sudo pacman -S --noconfirm python python-pip
|
|
fi
|
|
PY=python3
|
|
if ! ok_py $PY; then
|
|
echo "Please install Python 3.10 or newer with venv (Ubuntu/Debian: sudo apt install python3-venv), then run"
|
|
echo "./setup.sh again."
|
|
exit 1
|
|
fi
|
|
fi
|
|
# a private environment inside this folder (system Python stays untouched; newer distros refuse global pip)
|
|
$PY -m venv .venv || { rm -rf .venv; echo "could not create .venv: sudo apt install python3-venv"; exit 1; }
|
|
fi
|
|
exec .venv/bin/python setup.py "$@"
|