fix: pass --clear to uv venv to handle leftover venv directory

When re-running install.sh, the existing venv is rm -rf'd only if
bin/python is executable. If the directory exists but is broken or
partial, the rm guard is skipped and uv venv fails with exit code 2:
"A directory already exists at: .unsloth/studio/unsloth_studio".

Adding --clear lets uv replace any existing directory at the path,
fixing re-installs without requiring user intervention.
This commit is contained in:
Roland Tannous 2026-04-02 15:49:39 +00:00
commit afb929271c

View file

@ -927,7 +927,7 @@ fi
if [ ! -x "$VENV_DIR/bin/python" ]; then
step "venv" "creating Python ${PYTHON_VERSION} virtual environment"
substep "$VENV_DIR"
run_install_cmd "create venv" uv venv "$VENV_DIR" --python "$PYTHON_VERSION"
run_install_cmd "create venv" uv venv "$VENV_DIR" --python "$PYTHON_VERSION" --clear
fi
# Guard against Python 3.13.8 torch import bug on Apple Silicon