Ensure venv creation where python is unavailable (#21)

This commit is contained in:
Rob Ballantyne
2025-07-17 17:59:35 +01:00
committed by GitHub
parent 69d9b7455f
commit 9e369c55a5
+5 -3
View File
@@ -46,17 +46,19 @@ env | grep _ >> /etc/environment;
if [ ! -d "$ENV_PATH" ] if [ ! -d "$ENV_PATH" ]
then then
apt install -y python3.10-venv
echo "setting up venv" echo "setting up venv"
curl -LsSf https://astral.sh/uv/install.sh | sh
source ~/.local/bin/env
git clone https://github.com/vast-ai/pyworker "$SERVER_DIR" git clone https://github.com/vast-ai/pyworker "$SERVER_DIR"
python3 -m venv "$WORKSPACE_DIR/worker-env" uv venv --managed-python "$WORKSPACE_DIR/worker-env" -p 3.10
source "$WORKSPACE_DIR/worker-env/bin/activate" source "$WORKSPACE_DIR/worker-env/bin/activate"
pip install -r vast-pyworker/requirements.txt uv pip install -r vast-pyworker/requirements.txt
touch ~/.no_auto_tmux touch ~/.no_auto_tmux
else else
source ~/.local/bin/env
source "$WORKSPACE_DIR/worker-env/bin/activate" source "$WORKSPACE_DIR/worker-env/bin/activate"
echo "environment activated" echo "environment activated"
echo "venv: $VIRTUAL_ENV" echo "venv: $VIRTUAL_ENV"