Skip to content

Commit 65f6eaa

Browse files
jiagancdominicshanshan
authored andcommitted
[None][fix] Fix python-only build that uses TRTLLM_USE_PRECOMPILED (NVIDIA#6825)
Signed-off-by: Jiagan Cheng <[email protected]> Signed-off-by: Wangshanshan <[email protected]>
1 parent 700945b commit 65f6eaa

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
############################### BUILD CONFIGURATION ##############################################
33
####################################################################################################
44
[build-system]
5-
requires = ["setuptools >= 64"]
5+
requires = ["setuptools >= 64", "pip >= 24"]
66
build-backend = "setuptools.build_meta"
77

88
####################################################################################################

setup.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ def has_ext_modules(self):
120120
]
121121

122122

123-
def download_precompiled(workspace: str) -> str:
123+
def download_precompiled(workspace: str, version: str) -> str:
124124
import glob
125125
import subprocess
126126

127127
from setuptools.errors import SetupError
128128

129129
cmd = [
130-
"pip", "download", f"tensorrt_llm={get_version()}",
130+
"python3", "-m", "pip", "download", f"tensorrt_llm=={version}",
131131
f"--dest={workspace}", "--no-deps",
132132
"--extra-index-url=https://pypi.nvidia.com"
133133
]
@@ -201,17 +201,18 @@ def extract_from_precompiled(precompiled_location: str, package_data: List[str],
201201
wheel.extract(file)
202202

203203

204-
use_precompiled: bool = os.getenv("TRTLLM_USE_PRECOMPILED") == "1"
205-
precompiled_location: str = os.getenv("TRTLLM_PRECOMPILED_LOCATION")
206-
207-
if precompiled_location:
208-
use_precompiled = True
204+
precompiled: str | None = os.getenv("TRTLLM_USE_PRECOMPILED")
205+
precompiled_location: str | None = os.getenv("TRTLLM_PRECOMPILED_LOCATION")
206+
use_precompiled: bool = (precompiled is not None
207+
and precompiled != "0") or (precompiled_location
208+
is not None)
209209

210210
if use_precompiled:
211211
from tempfile import TemporaryDirectory
212212
with TemporaryDirectory() as tempdir:
213213
if not precompiled_location:
214-
precompiled_location = download_precompiled(tempdir)
214+
version = precompiled if precompiled != "1" else get_version()
215+
precompiled_location = download_precompiled(tempdir, version)
215216
extract_from_precompiled(precompiled_location, package_data, tempdir)
216217

217218
sanity_check()

0 commit comments

Comments
 (0)