@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 8af5a5c4e5
Fork 0

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 15, 16:00 UTC

fix: can not use uv run collect_env close #13888 (#15792)

Signed-off-by: yihong0618 <zouzou0208@gmail.com>

yihong committed Apr 1, 2025 at 15:45 UTC 8af5a5c4e580ee20674dfe8be8cd687677419d8c
1 file changed +18 -6
collect_env.py
+18 -6
@@ -482,16 +482,28 @@ def get_pip_packages(run_lambda, patterns=None):
482 if patterns is None:
483 patterns = DEFAULT_PIP_PATTERNS
484
485 - # People generally have `pip` as `pip` or `pip3`
486 - # But here it is invoked as `python -mpip`
487 - def run_with_pip(pip):
488 - out = run_and_read_all(run_lambda, pip + ["list", "--format=freeze"])
485 + def run_with_pip():
486 + try:
487 + import importlib.util
488 + pip_spec = importlib.util.find_spec('pip')
489 + pip_available = pip_spec is not None
490 + except ImportError:
491 + pip_available = False
492 +
493 + if pip_available:
494 + cmd = [sys.executable, '-mpip', 'list', '--format=freeze']
495 + elif os.environ.get("UV") is not None:
496 + print("uv is set")
497 + cmd = ["uv", "pip", "list", "--format=freeze"]
498 + else:
499 + raise RuntimeError("Could not collect pip list output (pip or uv module not available)")
500 +
501 + out = run_and_read_all(run_lambda, cmd)
502 return "\n".join(line for line in out.splitlines()
503 if any(name in line for name in patterns))
504
505 pip_version = 'pip3' if sys.version[0] == '3' else 'pip'
493 - out = run_with_pip([sys.executable, '-mpip'])
494 -
506 + out = run_with_pip()
507 return pip_version, out
508
509