@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 6550815c3a
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 8, 19:00 UTC

[XPU]Replace pip in docker.xpu with uv pip (#31112)

Signed-off-by: sihao.li <sihao.li@intel.com>

sihao_li committed Feb 6, 2026 at 14:02 UTC 6550815c3ad5fc20e6944483dd8a7a47c18b7c7d
1 file changed +46 -28
docker/Dockerfile.xpu
+46 -28
@@ -1,5 +1,10 @@
1 FROM intel/deep-learning-essentials:2025.3.2-0-devel-ubuntu24.04 AS vllm-base
2
3 +WORKDIR /workspace/
4 +
5 +ARG PYTHON_VERSION=3.12
6 +ARG PIP_EXTRA_INDEX_URL="https://download.pytorch.org/whl/xpu"
7 +
8 RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null && \
9 echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list && \
10 add-apt-repository -y ppa:kobuk-team/intel-graphics
@@ -22,13 +27,16 @@ RUN apt clean && apt-get update -y && \
27 python3.12-dev \
28 python3-pip
29
25 -RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1
26 -RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.12 1
27 -
30 RUN apt update && apt upgrade -y && \
31 apt install -y libze1 libze-dev libze-intel-gpu1 intel-opencl-icd libze-intel-gpu-raytracing intel-ocloc && \
32 apt install -y intel-oneapi-compiler-dpcpp-cpp-2025.3
33
34 +ENV PATH="/root/.local/bin:$PATH"
35 +ENV VIRTUAL_ENV="/opt/venv"
36 +ENV UV_PYTHON_INSTALL_DIR=/opt/uv/python
37 +RUN curl -LsSf https://astral.sh/uv/install.sh | sh
38 +RUN uv venv --python ${PYTHON_VERSION} --seed ${VIRTUAL_ENV}
39 +ENV PATH="$VIRTUAL_ENV/bin:$PATH"
40
41 # This oneccl contains the BMG support which is not the case for default version of oneapi 2025.2.
42 ARG ONECCL_INSTALLER="intel-oneccl-2021.15.7.8_offline.sh"
@@ -44,20 +52,31 @@ SHELL ["bash", "-c"]
52 CMD ["bash", "-c", "source /root/.bashrc && exec bash"]
53
54 WORKDIR /workspace/vllm
47 -COPY requirements/xpu.txt /workspace/vllm/requirements/xpu.txt
48 -COPY requirements/common.txt /workspace/vllm/requirements/common.txt
55
50 -# suppress the python externally managed environment error
51 -RUN python3 -m pip config set global.break-system-packages true
52 -
53 -RUN --mount=type=cache,target=/root/.cache/pip \
54 - pip install --no-cache-dir \
55 - -r requirements/xpu.txt
56 -
57 -# arctic-inference is built from source which needs torch-xpu properly installed
58 -# used for suffix method speculative decoding
59 -RUN --mount=type=cache,target=/root/.cache/pip \
60 - pip install --no-cache-dir arctic-inference==0.1.1
56 +ENV UV_HTTP_TIMEOUT=500
57 +
58 +# Configure package index for XPU
59 +ENV PIP_EXTRA_INDEX_URL=${PIP_EXTRA_INDEX_URL}
60 +ENV UV_EXTRA_INDEX_URL=${PIP_EXTRA_INDEX_URL}
61 +ENV UV_INDEX_STRATEGY="unsafe-best-match"
62 +ENV UV_LINK_MODE="copy"
63 +
64 +RUN --mount=type=cache,target=/root/.cache/uv \
65 + --mount=type=bind,src=requirements/common.txt,target=/workspace/vllm/requirements/common.txt \
66 + --mount=type=bind,src=requirements/xpu.txt,target=/workspace/vllm/requirements/xpu.txt \
67 + uv pip install --upgrade pip && \
68 + uv pip install -r requirements/xpu.txt
69 +
70 + # used for suffix method speculative decoding
71 + # build deps for proto + nanobind-based extensions to set up the build environment
72 +RUN --mount=type=cache,target=/root/.cache/uv \
73 + uv pip install grpcio-tools protobuf nanobind
74 + # arctic-inference is built from source which needs torch-xpu properly installed first
75 +RUN --mount=type=cache,target=/root/.cache/uv \
76 + source /opt/intel/oneapi/setvars.sh --force && \
77 + source /opt/intel/oneapi/ccl/2021.15/env/vars.sh --force && \
78 + export CMAKE_PREFIX_PATH="$(python -c 'import site; print(site.getsitepackages()[0])'):${CMAKE_PREFIX_PATH}" && \
79 + uv pip install --no-build-isolation arctic-inference==0.1.1
80
81 ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib/"
82
@@ -69,33 +88,32 @@ RUN --mount=type=bind,source=.git,target=.git \
88 ENV VLLM_TARGET_DEVICE=xpu
89 ENV VLLM_WORKER_MULTIPROC_METHOD=spawn
90
72 -RUN --mount=type=cache,target=/root/.cache/pip \
91 +RUN --mount=type=cache,target=/root/.cache/uv \
92 --mount=type=bind,source=.git,target=.git \
74 - pip install --no-build-isolation .
93 + uv pip install --no-build-isolation .
94
95 CMD ["/bin/bash"]
96
97 FROM vllm-base AS vllm-openai
98
99 # install additional dependencies for openai api server
81 -RUN --mount=type=cache,target=/root/.cache/pip \
82 - pip install accelerate hf_transfer pytest pytest_asyncio lm_eval[api] modelscope
100 +RUN --mount=type=cache,target=/root/.cache/uv \
101 + uv pip install accelerate hf_transfer pytest pytest_asyncio lm_eval[api] modelscope
102
103 # install development dependencies (for testing)
85 -RUN python3 -m pip install -e tests/vllm_test_utils
104 +RUN uv pip install -e tests/vllm_test_utils
105
106 # install nixl from source code
107 ENV NIXL_VERSION=0.7.0
89 -RUN python3 /workspace/vllm/tools/install_nixl_from_source_ubuntu.py
108 +RUN python /workspace/vllm/tools/install_nixl_from_source_ubuntu.py
109
110 # FIX triton
92 -RUN --mount=type=cache,target=/root/.cache/pip pip uninstall triton triton-xpu -y && pip install triton-xpu==3.6.0 --extra-index-url=https://download.pytorch.org/whl/xpu
93 -
94 -# PyJWT-2.7.0 will influence some wheel behaviors, remove its dist-info to avoid conflicts
95 -RUN rm /usr/lib/python3/dist-packages/PyJWT-2.7.0.dist-info/ -rf
111 +RUN --mount=type=cache,target=/root/.cache/uv \
112 + uv pip uninstall triton triton-xpu && \
113 + uv pip install triton-xpu==3.6.0
114
115 # remove torch bundled oneccl to avoid conflicts
98 -RUN --mount=type=cache,target=/root/.cache/pip \
99 - pip uninstall oneccl oneccl-devel -y
116 +RUN --mount=type=cache,target=/root/.cache/uv \
117 + uv pip uninstall oneccl oneccl-devel
118
119 ENTRYPOINT ["vllm", "serve"]