Skip to content

Commit 7ffcccf

Browse files
authored
Revert "[CI/Build] Use uv python for docker rather than ppa:deadsnakess/ppa (vllm-project#13569)" (vllm-project#15377)
Signed-off-by: simon-mo <simon.mo@hey.com>
1 parent cc8accf commit 7ffcccf

File tree

1 file changed

+51
-38
lines changed

1 file changed

+51
-38
lines changed

Dockerfile

Lines changed: 51 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,22 @@ ARG PYTHON_VERSION=3.12
1414
ARG TARGETPLATFORM
1515
ENV DEBIAN_FRONTEND=noninteractive
1616

17-
# Install minimal dependencies and uv
18-
RUN apt-get update -y \
19-
&& apt-get install -y ccache git curl wget sudo \
20-
&& curl -LsSf https://astral.sh/uv/install.sh | sh
21-
22-
# Add uv to PATH
23-
ENV PATH="/root/.local/bin:$PATH"
24-
# Create venv with specified Python and activate by placing at the front of path
25-
ENV VIRTUAL_ENV="/opt/venv"
26-
RUN uv venv --python ${PYTHON_VERSION} --seed ${VIRTUAL_ENV}
27-
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
17+
# Install Python and other dependencies
18+
RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections \
19+
&& echo 'tzdata tzdata/Zones/America select Los_Angeles' | debconf-set-selections \
20+
&& apt-get update -y \
21+
&& apt-get install -y ccache software-properties-common git curl sudo \
22+
&& add-apt-repository ppa:deadsnakes/ppa \
23+
&& apt-get update -y \
24+
&& apt-get install -y python${PYTHON_VERSION} python${PYTHON_VERSION}-dev python${PYTHON_VERSION}-venv \
25+
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 1 \
26+
&& update-alternatives --set python3 /usr/bin/python${PYTHON_VERSION} \
27+
&& ln -sf /usr/bin/python${PYTHON_VERSION}-config /usr/bin/python3-config \
28+
&& curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION} \
29+
&& python3 --version && python3 -m pip --version
30+
# Install uv for faster pip installs
31+
RUN --mount=type=cache,target=/root/.cache/uv \
32+
python3 -m pip install uv
2833

2934
# This timeout (in seconds) is necessary when installing some dependencies via uv since it's likely to time out
3035
# Reference: https://github.com/astral-sh/uv/pull/1694
@@ -46,20 +51,22 @@ RUN ldconfig /usr/local/cuda-$(echo $CUDA_VERSION | cut -d. -f1,2)/compat/
4651

4752
WORKDIR /workspace
4853

54+
# install build and runtime dependencies
55+
4956
# arm64 (GH200) build follows the practice of "use existing pytorch" build,
5057
# we need to install torch and torchvision from the nightly builds first,
5158
# pytorch will not appear as a vLLM dependency in all of the following steps
5259
# after this step
5360
RUN --mount=type=cache,target=/root/.cache/uv \
5461
if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
55-
uv pip install --index-url https://download.pytorch.org/whl/nightly/cu128 "torch==2.8.0.dev20250318+cu128" "torchvision==0.22.0.dev20250319"; \
56-
uv pip install --index-url https://download.pytorch.org/whl/nightly/cu128 --pre pytorch_triton==3.3.0+gitab727c40; \
62+
uv pip install --system --index-url https://download.pytorch.org/whl/nightly/cu128 "torch==2.8.0.dev20250318+cu128" "torchvision==0.22.0.dev20250319"; \
63+
uv pip install --system --index-url https://download.pytorch.org/whl/nightly/cu128 --pre pytorch_triton==3.3.0+gitab727c40; \
5764
fi
5865

5966
COPY requirements/common.txt requirements/common.txt
6067
COPY requirements/cuda.txt requirements/cuda.txt
6168
RUN --mount=type=cache,target=/root/.cache/uv \
62-
uv pip install -r requirements/cuda.txt
69+
uv pip install --system -r requirements/cuda.txt
6370

6471
# cuda arch list used by torch
6572
# can be useful for both `dev` and `test`
@@ -84,7 +91,7 @@ COPY requirements/build.txt requirements/build.txt
8491
ENV UV_HTTP_TIMEOUT=500
8592

8693
RUN --mount=type=cache,target=/root/.cache/uv \
87-
uv pip install -r requirements/build.txt
94+
uv pip install --system -r requirements/build.txt
8895

8996
COPY . .
9097
ARG GIT_REPO_CHECK=0
@@ -156,7 +163,7 @@ COPY requirements/lint.txt requirements/lint.txt
156163
COPY requirements/test.txt requirements/test.txt
157164
COPY requirements/dev.txt requirements/dev.txt
158165
RUN --mount=type=cache,target=/root/.cache/uv \
159-
uv pip install -r requirements/dev.txt
166+
uv pip install --system -r requirements/dev.txt
160167
#################### DEV IMAGE ####################
161168

162169
#################### vLLM installation IMAGE ####################
@@ -172,18 +179,23 @@ ARG TARGETPLATFORM
172179
RUN PYTHON_VERSION_STR=$(echo ${PYTHON_VERSION} | sed 's/\.//g') && \
173180
echo "export PYTHON_VERSION_STR=${PYTHON_VERSION_STR}" >> /etc/environment
174181

175-
# Install minimal dependencies and uv
176-
RUN apt-get update -y \
177-
&& apt-get install -y ccache git curl wget sudo vim \
178-
&& apt-get install -y ffmpeg libsm6 libxext6 libgl1 libibverbs-dev \
179-
&& curl -LsSf https://astral.sh/uv/install.sh | sh
180-
181-
# Add uv to PATH
182-
ENV PATH="/root/.local/bin:$PATH"
183-
# Create venv with specified Python and activate by placing at the front of path
184-
ENV VIRTUAL_ENV="/opt/venv"
185-
RUN uv venv --python ${PYTHON_VERSION} --seed ${VIRTUAL_ENV}
186-
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
182+
# Install Python and other dependencies
183+
RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections \
184+
&& echo 'tzdata tzdata/Zones/America select Los_Angeles' | debconf-set-selections \
185+
&& apt-get update -y \
186+
&& apt-get install -y ccache software-properties-common git curl wget sudo vim python3-pip \
187+
&& apt-get install -y ffmpeg libsm6 libxext6 libgl1 \
188+
&& add-apt-repository ppa:deadsnakes/ppa \
189+
&& apt-get update -y \
190+
&& apt-get install -y python${PYTHON_VERSION} python${PYTHON_VERSION}-dev python${PYTHON_VERSION}-venv libibverbs-dev \
191+
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 1 \
192+
&& update-alternatives --set python3 /usr/bin/python${PYTHON_VERSION} \
193+
&& ln -sf /usr/bin/python${PYTHON_VERSION}-config /usr/bin/python3-config \
194+
&& curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION} \
195+
&& python3 --version && python3 -m pip --version
196+
# Install uv for faster pip installs
197+
RUN --mount=type=cache,target=/root/.cache/uv \
198+
python3 -m pip install uv
187199

188200
# This timeout (in seconds) is necessary when installing some dependencies via uv since it's likely to time out
189201
# Reference: https://github.com/astral-sh/uv/pull/1694
@@ -201,14 +213,14 @@ RUN ldconfig /usr/local/cuda-$(echo $CUDA_VERSION | cut -d. -f1,2)/compat/
201213
# after this step
202214
RUN --mount=type=cache,target=/root/.cache/uv \
203215
if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
204-
uv pip install --index-url https://download.pytorch.org/whl/nightly/cu128 "torch==2.8.0.dev20250318+cu128" "torchvision==0.22.0.dev20250319"; \
205-
uv pip install --index-url https://download.pytorch.org/whl/nightly/cu128 --pre pytorch_triton==3.3.0+gitab727c40; \
216+
uv pip install --system --index-url https://download.pytorch.org/whl/nightly/cu128 "torch==2.8.0.dev20250318+cu128" "torchvision==0.22.0.dev20250319"; \
217+
uv pip install --system --index-url https://download.pytorch.org/whl/nightly/cu128 --pre pytorch_triton==3.3.0+gitab727c40; \
206218
fi
207219

208220
# Install vllm wheel first, so that torch etc will be installed.
209221
RUN --mount=type=bind,from=build,src=/workspace/dist,target=/vllm-workspace/dist \
210222
--mount=type=cache,target=/root/.cache/uv \
211-
uv pip install dist/*.whl --verbose
223+
uv pip install --system dist/*.whl --verbose
212224

213225
# If we need to build FlashInfer wheel before its release:
214226
# $ export FLASHINFER_ENABLE_AOT=1
@@ -223,8 +235,9 @@ RUN --mount=type=bind,from=build,src=/workspace/dist,target=/vllm-workspace/dist
223235
# $ # upload the wheel to a public location, e.g. https://wheels.vllm.ai/flashinfer/524304395bd1d8cd7d07db083859523fcaa246a4/flashinfer_python-0.2.1.post1+cu124torch2.5-cp38-abi3-linux_x86_64.whl
224236

225237
RUN --mount=type=cache,target=/root/.cache/uv \
238+
. /etc/environment && \
226239
if [ "$TARGETPLATFORM" != "linux/arm64" ]; then \
227-
uv pip install https://github.com/flashinfer-ai/flashinfer/releases/download/v0.2.1.post2/flashinfer_python-0.2.1.post2+cu124torch2.6-cp38-abi3-linux_x86_64.whl ; \
240+
uv pip install --system https://github.com/flashinfer-ai/flashinfer/releases/download/v0.2.1.post2/flashinfer_python-0.2.1.post2+cu124torch2.6-cp38-abi3-linux_x86_64.whl ; \
228241
fi
229242
COPY examples examples
230243

@@ -234,7 +247,7 @@ COPY examples examples
234247
# TODO: Remove this once FlashInfer AOT wheel is fixed
235248
COPY requirements/build.txt requirements/build.txt
236249
RUN --mount=type=cache,target=/root/.cache/uv \
237-
uv pip install -r requirements/build.txt
250+
uv pip install --system -r requirements/build.txt
238251

239252
#################### vLLM installation IMAGE ####################
240253

@@ -251,15 +264,15 @@ ENV UV_HTTP_TIMEOUT=500
251264

252265
# install development dependencies (for testing)
253266
RUN --mount=type=cache,target=/root/.cache/uv \
254-
uv pip install -r requirements/dev.txt
267+
uv pip install --system -r requirements/dev.txt
255268

256269
# install development dependencies (for testing)
257270
RUN --mount=type=cache,target=/root/.cache/uv \
258-
uv pip install -e tests/vllm_test_utils
271+
uv pip install --system -e tests/vllm_test_utils
259272

260273
# enable fast downloads from hf (for testing)
261274
RUN --mount=type=cache,target=/root/.cache/uv \
262-
uv pip install hf_transfer
275+
uv pip install --system hf_transfer
263276
ENV HF_HUB_ENABLE_HF_TRANSFER 1
264277

265278
# Copy in the v1 package for testing (it isn't distributed yet)
@@ -284,9 +297,9 @@ ENV UV_HTTP_TIMEOUT=500
284297
# install additional dependencies for openai api server
285298
RUN --mount=type=cache,target=/root/.cache/uv \
286299
if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
287-
uv pip install accelerate hf_transfer 'modelscope!=1.15.0' 'bitsandbytes>=0.42.0' 'timm==0.9.10' boto3 runai-model-streamer runai-model-streamer[s3]; \
300+
uv pip install --system accelerate hf_transfer 'modelscope!=1.15.0' 'bitsandbytes>=0.42.0' 'timm==0.9.10' boto3 runai-model-streamer runai-model-streamer[s3]; \
288301
else \
289-
uv pip install accelerate hf_transfer 'modelscope!=1.15.0' 'bitsandbytes>=0.45.3' 'timm==0.9.10' boto3 runai-model-streamer runai-model-streamer[s3]; \
302+
uv pip install --system accelerate hf_transfer 'modelscope!=1.15.0' 'bitsandbytes>=0.45.3' 'timm==0.9.10' boto3 runai-model-streamer runai-model-streamer[s3]; \
290303
fi
291304

292305
ENV VLLM_USAGE_SOURCE production-docker-image

0 commit comments

Comments
 (0)