@@ -594,10 +594,29 @@ def run(cmd, timeout=5):
594594 except Exception:
595595 return None
596596
597+ def find_python():
598+ for p in ['/opt/dynamo/venv/bin/python3', '/opt/venv/bin/python3', 'python3']:
599+ if run(f'command -v {{0}} || test -x {{0}}'.format(p)):
600+ return p
601+ return 'python3'
602+
603+ PY = find_python()
604+
597605def pip_pkgs():
598- out = run('python3 -m pip freeze 2>/dev/null') or run('pip freeze')
599- if not out: return []
600- return sorted([l.strip() for l in out.splitlines() if l.strip()], key=lambda s: s.lower())
606+ pkgs = set()
607+ for cmd in [
608+ f'{{PY}} -m pip freeze 2>/dev/null'.format(PY=PY),
609+ 'python3 -m pip freeze 2>/dev/null',
610+ 'pip freeze 2>/dev/null',
611+ 'uv pip freeze 2>/dev/null',
612+ ]:
613+ out = run(cmd)
614+ if out:
615+ for line in out.splitlines():
616+ line = line.strip()
617+ if line and not line.startswith('#'):
618+ pkgs.add(line)
619+ return sorted(pkgs, key=lambda s: s.lower())
601620
602621def gpu_info():
603622 out = run('nvidia-smi --query-gpu=name,driver_version,memory.total --format=csv,noheader')
@@ -611,19 +630,19 @@ def gpu_info():
611630
612631def framework_versions():
613632 versions = {{}}
614- for name, cmd in [
615- ('vllm', 'python3 -c "import vllm; print(vllm.__version__)" '),
616- ('sglang', 'python3 -c "import sglang; print(sglang.__version__)" '),
617- ('tensorrt_llm', 'python3 -c "import tensorrt_llm; print(tensorrt_llm.__version__)" '),
618- ('dynamo ', 'python3 -c "import importlib.metadata; print(importlib.metadata.version( \\ \" ai-dynamo \\ \" ))" '),
633+ for name, mod in [
634+ ('vllm', 'vllm'),
635+ ('sglang', 'sglang'),
636+ ('tensorrt_llm', 'tensorrt_llm'),
637+ ('torch ', 'torch '),
619638 ]:
620- v = run(cmd )
639+ v = run(f'{{PY}} -c "import {{mod}}; print({{mod}}.__version__)"'.format(PY=PY, mod=mod) )
621640 if v:
622641 versions[name] = v
623- # torch embeds a git hash in the version string (e.g. 2.10.0a0+b4e4ee81d3.nv25.12)
624- torch_v = run('python3 -c "import torch ; print(torch.__version__)"' )
625- if torch_v :
626- versions['torch '] = torch_v
642+ # dynamo uses ai-dynamo package name
643+ v = run(f"{{PY}} -c \\ "import importlib.metadata ; print(importlib.metadata.version('ai-dynamo')) \\ "".format(PY=PY) )
644+ if v :
645+ versions['dynamo '] = v
627646 return versions
628647
629648def model_identity(model_path):
@@ -666,7 +685,7 @@ def model_identity(model_path):
666685 'gpu': gpu_info(),
667686 'python_version': platform.python_version(),
668687 'cuda_version': run('nvcc --version 2>/dev/null | grep release') or 'unavailable',
669- 'nccl_version': run('python3 -c "import torch; print(torch.cuda.nccl.version())"') or 'unavailable',
688+ 'nccl_version': run(f'{{PY}} -c "import torch; print(torch.cuda.nccl.version())"'.format(PY=PY) ) or 'unavailable',
670689 'frameworks': framework_versions(),
671690 'model': model_identity('/model'),
672691 'pip_packages': pip_pkgs(),
0 commit comments