fix(cookbook): diagnose sglang native deps (#4112)

This commit is contained in:
cyq
2026-06-15 14:14:37 +08:00
committed by GitHub
parent 8cff1f87ee
commit aac589ee49
5 changed files with 60 additions and 0 deletions
+21
View File
@@ -13,3 +13,24 @@ def test_diagnose_vllm_modelopt_lm_head_error():
assert "ModelOpt LM-head" in diagnosis["message"]
assert diagnosis["suggestions"][0]["op"] == "manual"
assert "provides this CLI" in diagnosis["suggestions"][0]["label"]
def test_diagnose_sglang_native_dependency_errors():
output = """
/tmp/cuda_utils.c:7:10: fatal error: Python.h: No such file or directory
ImportError:
[sgl_kernel] CRITICAL: Could not load any common_ops library!
Please ensure sgl_kernel is properly installed with:
pip install --upgrade sglang-kernel
Error details from previous import attempts:
- ImportError: libnuma.so.1: cannot open shared object file
"""
diagnosis = _diagnose_serve_output(output)
assert diagnosis is not None
assert "SGLang native dependencies" in diagnosis["message"]
labels = [suggestion["label"] for suggestion in diagnosis["suggestions"]]
assert any("libnuma-dev" in label for label in labels)
assert any("python3.12-dev" in label for label in labels)
assert any("sglang-kernel" in label for label in labels)
+10
View File
@@ -10,3 +10,13 @@ def test_repair_kernels_pip_spec_is_shell_quoted():
assert '"kernels<0.15"' in source
assert " --break-system-packages kernels<0.15" not in source
def test_sglang_native_dependency_diagnosis_is_exposed_to_browser():
source = DIAGNOSIS_JS.read_text(encoding="utf-8")
assert r"Python\.h" in source
assert r"libnuma\.so\.1" in source
assert "SGLang native dependencies" in source
assert "libnuma-dev python3.12-dev build-essential" in source
assert "sglang-kernel" in source