Disable pip cache for Cookbook dependency installs (off the home disk) (#1477)

Cookbook dependency installs (vLLM and friends) build large wheels; pip's
default cache lives under $HOME/.cache/pip, so on a small home filesystem the
build dies mid-way with "[Errno 28] No space left on device" (issue #1219) and
the dependency ends up "installed" but unusable (issue #1459).

Add `--no-cache-dir` to the dependency pip-install command (the maintainer's
suggested PIP_CACHE_DIR= workaround, made the default) via a small
_pip_install_no_cache() helper applied at the install chokepoint. Consistent
with the existing --no-cache-dir on the llama-cpp-python build. Idempotent;
non-pip-install serve commands are untouched.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
lekt8
2026-06-03 13:23:49 +08:00
committed by GitHub
parent 1feb2ae7d5
commit ffb8fd16bc
3 changed files with 40 additions and 1 deletions

View File

@@ -415,3 +415,23 @@ def test_cached_model_scan_reports_plain_dir_gguf(tmp_path):
assert ggufs[1]["size_bytes"] == len(b"part1part2part3")
assert ggufs[2]["quant"] == "Q6_K_XL"
assert ggufs[3]["quant"] == "BF16"
# ── #1219 / #1459: keep big dependency wheel builds off the home pip cache ──
def test_pip_install_no_cache_injects_flag():
from routes.cookbook_helpers import _pip_install_no_cache
assert _pip_install_no_cache("python -m pip install vllm") == \
"python -m pip install --no-cache-dir vllm"
assert _pip_install_no_cache("pip install -q huggingface-hub") == \
"pip install --no-cache-dir -q huggingface-hub"
def test_pip_install_no_cache_is_idempotent_and_scoped():
from routes.cookbook_helpers import _pip_install_no_cache
# already present -> unchanged
already = "pip install --no-cache-dir vllm"
assert _pip_install_no_cache(already) == already
# not a pip install -> unchanged
assert _pip_install_no_cache("vllm serve --model x") == "vllm serve --model x"
assert _pip_install_no_cache("") == ""