From 6d536d824d0284bd67750a1ca02532098df7b0ba Mon Sep 17 00:00:00 2001 From: danielhanchen Date: Sun, 24 May 2026 13:24:45 +0000 Subject: [PATCH] Dockerfile: re-upgrade numpy after vLLM install (2.2.6 wheel is broken) vLLM 0.19.1 pulls numpy down to 2.2.6 whose wheel ships numpy/_core/ without the tests/ subdir, but numpy/testing/_private/utils.py imports `from numpy._core.tests._natype import pd_NA`. Anything that hits `from numpy import *` (scipy._lib.array_api_compat does) then crashes. unsloth_zoo's gemma patch does `from transformers.processing_utils import Unpack` which touches that path, so `import unsloth` blew up on every GRPO notebook in the vLLM image. Bump numpy to >=2.4 right after the vllm install; vllm still imports fine on numpy 2.4.6 (verified locally). --- docker/Dockerfile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 8cf6da4bda..2824111912 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -204,8 +204,19 @@ RUN set -eux \ --extra-index-url https://download.pytorch.org/whl/cu128 \ "torch==2.10.0" \ vllm; \ - echo ">> vLLM installed:"; \ + # vLLM nightly pulls numpy down to 2.2.6 whose wheel ships a broken + # numpy.testing (`from numpy._core.tests._natype import pd_NA` -- the + # tests/ directory is stripped from the wheel). Any path that hits + # `from numpy import *` (e.g. scipy.optimize -> scipy._lib.array_api) + # then crashes, taking `import unsloth` with it via unsloth_zoo's + # `from transformers.processing_utils import Unpack`. Upgrade numpy + # back to a release that has a self-consistent testing module. + ${VENV}/bin/uv pip install \ + --python ${VENV}/bin/python \ + --upgrade "numpy>=2.4"; \ + echo ">> vLLM installed (numpy re-upgraded post-vllm):"; \ ${VENV}/bin/python -c "import vllm; print('vllm', vllm.__version__)"; \ + ${VENV}/bin/python -c "import numpy.testing, numpy; print('numpy', numpy.__version__, 'testing ok')"; \ else \ echo ">> vLLM skipped (INSTALL_VLLM=${INSTALL_VLLM}, TARGETARCH=${TARGETARCH:-amd64})"; \ fi