Skip to content

Commit a63fa6c

Browse files
yankayxuebwang-amd
authored andcommitted
[BugFix] python collect_env.py and vllm collect-env compatibility with uv venv (vllm-project#24066)
Signed-off-by: Kay Yan <kay.yan@daocloud.io> Signed-off-by: xuebwang-amd <xuebwang@amd.com>
1 parent b7998ae commit a63fa6c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

vllm/collect_env.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,16 @@ def get_libc_version():
489489
return '-'.join(platform.libc_ver())
490490

491491

492+
def is_uv_venv():
493+
if os.environ.get("UV"):
494+
return True
495+
pyvenv_cfg_path = os.path.join(sys.prefix, 'pyvenv.cfg')
496+
if os.path.exists(pyvenv_cfg_path):
497+
with open(pyvenv_cfg_path, 'r') as f:
498+
return any(line.startswith('uv = ') for line in f)
499+
return False
500+
501+
492502
def get_pip_packages(run_lambda, patterns=None):
493503
"""Return `pip list` output. Note: will also find conda-installed pytorch and numpy packages."""
494504
if patterns is None:
@@ -504,7 +514,7 @@ def run_with_pip():
504514

505515
if pip_available:
506516
cmd = [sys.executable, '-mpip', 'list', '--format=freeze']
507-
elif os.environ.get("UV") is not None:
517+
elif is_uv_venv():
508518
print("uv is set")
509519
cmd = ["uv", "pip", "list", "--format=freeze"]
510520
else:

0 commit comments

Comments
 (0)