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 14, 05:30 UTC
[build] add torch to tool.uv no-build-isolation-package (#24303)
Signed-off-by: youkaichao <youkaichao@gmail.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
youkaichao committed
Sep 11, 2025 at 21:19 UTC
f510715882304796a96e33028b4f6de1b026c2c7
3 files changed
+9
-22
docs/getting_started/installation/gpu/cuda.inc.md
+4
-4
@@ -165,14 +165,14 @@ There are scenarios where the PyTorch dependency cannot be easily installed with
165
- Building vLLM with PyTorch nightly or a custom PyTorch build.
166
- Building vLLM with aarch64 and CUDA (GH200), where the PyTorch wheels are not available on PyPI. Currently, only the PyTorch nightly has wheels for aarch64 with CUDA. You can run `uv pip install --index-url https://download.pytorch.org/whl/nightly/cu128 torch torchvision torchaudio` to [install PyTorch nightly](https://pytorch.org/get-started/locally/) and then build vLLM on top of it.
167
168
-To build vLLM using an existing PyTorch installation:
168
+To build vLLM using an existing PyTorch installation, it is recommended to use `uv`, because it has [a unique mechanism](https://docs.astral.sh/uv/concepts/projects/config/#disabling-build-isolation) for disabling build isolation for specific packages and vLLM leverages this mechanism to specify `torch` as the package to disable build isolation.
169
170
```bash
171
+# install PyTorch first, either from PyPI or from source
172
git clone https://github.com/vllm-project/vllm.git
173
cd vllm
173
-python use_existing_torch.py
174
-uv pip install -r requirements/build.txt
175
-uv pip install --no-build-isolation -e .
174
+# pip install -e . does not work directly, only uv can do this
175
+uv pip install -e .
176
```
177
178
##### Use the local cutlass for compilation
pyproject.toml
+3
@@ -345,3 +345,6 @@ extend-ignore-re = []
345
windo = "windo"
346
347
[tool.typos.type.vimscript.extend-words]
348
+
349
+[tool.uv]
350
+no-build-isolation-package = ["torch"]
use_existing_torch.py
+2
-18
@@ -1,21 +1,5 @@
1
# SPDX-License-Identifier: Apache-2.0
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
4
-import glob
5
-
6
-requires_files = glob.glob('requirements/*.txt')
7
-requires_files += ["pyproject.toml"]
8
-for file in requires_files:
9
- print(f">>> cleaning {file}")
10
- with open(file) as f:
11
- lines = f.readlines()
12
- if "torch" in "".join(lines).lower():
13
- print("removed:")
14
- with open(file, 'w') as f:
15
- for line in lines:
16
- if 'torch' not in line.lower():
17
- f.write(line)
18
- else:
19
- print(line.strip())
20
- print(f"<<< done cleaning {file}")
21
- print()
4
+print("vLLM is now using 'uv' to disable build isolation for 'torch'.")
5
+print("Please instead install vLLM with 'uv pip install -e .' (must use 'uv')")