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).
This commit is contained in:
danielhanchen 2026-05-24 13:24:45 +00:00
commit 6d536d824d

View file

@ -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