diff --git a/docs/getting_started/installation/gpu/cuda.inc.md b/docs/getting_started/installation/gpu/cuda.inc.md index 275232e12e08..01c5f5fc02f3 100644 --- a/docs/getting_started/installation/gpu/cuda.inc.md +++ b/docs/getting_started/installation/gpu/cuda.inc.md @@ -165,14 +165,14 @@ There are scenarios where the PyTorch dependency cannot be easily installed with - Building vLLM with PyTorch nightly or a custom PyTorch build. - 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. -To build vLLM using an existing PyTorch installation: +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. ```bash +# install PyTorch first, either from PyPI or from source git clone https://github.com/vllm-project/vllm.git cd vllm -python use_existing_torch.py -uv pip install -r requirements/build.txt -uv pip install --no-build-isolation -e . +# pip install -e . does not work directly, only uv can do this +uv pip install -e . ``` ##### Use the local cutlass for compilation diff --git a/pyproject.toml b/pyproject.toml index 7aa0371f38dc..416423abcad8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -345,3 +345,6 @@ extend-ignore-re = [] windo = "windo" [tool.typos.type.vimscript.extend-words] + +[tool.uv] +no-build-isolation-package = ["torch"] diff --git a/use_existing_torch.py b/use_existing_torch.py index a9f79e16981c..b5aafdde16c2 100644 --- a/use_existing_torch.py +++ b/use_existing_torch.py @@ -1,21 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project -import glob - -requires_files = glob.glob('requirements/*.txt') -requires_files += ["pyproject.toml"] -for file in requires_files: - print(f">>> cleaning {file}") - with open(file) as f: - lines = f.readlines() - if "torch" in "".join(lines).lower(): - print("removed:") - with open(file, 'w') as f: - for line in lines: - if 'torch' not in line.lower(): - f.write(line) - else: - print(line.strip()) - print(f"<<< done cleaning {file}") - print() +print("vLLM is now using 'uv' to disable build isolation for 'torch'.") +print("Please instead install vLLM with 'uv pip install -e .' (must use 'uv')")