{"record":{"id":"16b5da2b8666b2d6","repo":"sgl-project/sglang","slug":"pkg-is-installed-with-version-installed-version","errorCode":null,"errorMessage":"{pkg} is installed with version {installed_version}, which is less than the minimum required version {min_version}. {message}","messagePattern":"(.+?) is installed with version (.+?), which is less than the minimum required version (.+?)\\. (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/utils/common.py","lineNumber":2127,"sourceCode":"    }\n)\n\n\ndef _should_skip_kernel_pkg_version_check(pkg: str) -> bool:\n    return (\n        pkg in _KERNEL_VERSION_CHECK_PACKAGES\n        and envs.SGLANG_SKIP_SGL_KERNEL_VERSION_CHECK.get()\n    )\n\n\ndef assert_pkg_version(pkg: str, min_version: str, message: str):\n    if _should_skip_kernel_pkg_version_check(pkg):\n        return\n\n    try:\n        installed_version = version(pkg)\n        if pkg_version.parse(installed_version) < pkg_version.parse(min_version):\n            raise Exception(\n                f\"{pkg} is installed with version {installed_version}, which \"\n                f\"is less than the minimum required version {min_version}. \" + message\n            )\n    except PackageNotFoundError:\n        raise Exception(\n            f\"{pkg} with minimum required version {min_version} is not installed. \"\n            + message\n        )\n\n\ndef check_pkg_version_at_least(pkg: str, min_version: str) -> bool:\n    \"\"\"\n    Check if a package is installed and meets the minimum version requirement.\n\n    Args:\n        pkg: Package name (distribution name, e.g., \"flashinfer-python\")\n        min_version: Minimum version required (e.g., \"0.6.17\")\n","sourceCodeStart":2109,"sourceCodeEnd":2145,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/utils/common.py#L2109-L2145","documentation":"A hard dependency check found an installed package below the minimum required version (e.g. sgl-kernel or flashinfer). The version comparison uses packaging.version.parse, and the failure message includes the offending version and remediation hint.","triggerScenarios":"Importing sglang modules that call is_sm90_supported/other kernel-availability checks after downgrading or installing an older sgl-kernel/flashinfer wheel.","commonSituations":"Mixed-version installs after pip dependency resolution, stale environments after upgrading sglang but not sgl-kernel, or installing CPU/py-only wheels.","solutions":["pip install -U <pkg>>=<min_version> (exact version from the message)","Reinstall sglang in a fresh environment so pinned kernel deps resolve together","If intentional for testing, use the documented skip mechanism for the kernel version check rather than ignoring the error"],"exampleFix":"// before\npip install sgl-kernel==0.0.4  # sglang needs >=0.0.5\n// after\npip install -U 'sgl-kernel>=0.0.5'","handlingStrategy":"validation","validationCode":"from importlib.metadata import version\nfrom packaging import version as pv\nassert pv.parse(version(\"sgl-kernel\")) >= pv.parse(MIN, )","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin sglang and its kernel wheels together in requirements","Run a startup version check in your own launcher to fail fast with a clear message"],"tags":["versioning","dependencies","packaging","pip"],"backgroundTag":"package-version-mismatch","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}