@@ -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
210210if 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
217218sanity_check ()
0 commit comments