sgl-project/sglang · error · Exception

{pkg} is installed with version {installed_version}, which i

Error message

{pkg} is installed with version {installed_version}, which is less than the minimum required version {min_version}. {message}

What it means

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.

Source

Thrown at python/sglang/srt/utils/common.py:2127

    }
)


def _should_skip_kernel_pkg_version_check(pkg: str) -> bool:
    return (
        pkg in _KERNEL_VERSION_CHECK_PACKAGES
        and envs.SGLANG_SKIP_SGL_KERNEL_VERSION_CHECK.get()
    )


def assert_pkg_version(pkg: str, min_version: str, message: str):
    if _should_skip_kernel_pkg_version_check(pkg):
        return

    try:
        installed_version = version(pkg)
        if pkg_version.parse(installed_version) < pkg_version.parse(min_version):
            raise Exception(
                f"{pkg} is installed with version {installed_version}, which "
                f"is less than the minimum required version {min_version}. " + message
            )
    except PackageNotFoundError:
        raise Exception(
            f"{pkg} with minimum required version {min_version} is not installed. "
            + message
        )


def check_pkg_version_at_least(pkg: str, min_version: str) -> bool:
    """
    Check if a package is installed and meets the minimum version requirement.

    Args:
        pkg: Package name (distribution name, e.g., "flashinfer-python")
        min_version: Minimum version required (e.g., "0.6.17")

View on GitHub (pinned to 0132848349)

Solutions

  1. pip install -U <pkg>>=<min_version> (exact version from the message)
  2. Reinstall sglang in a fresh environment so pinned kernel deps resolve together
  3. If intentional for testing, use the documented skip mechanism for the kernel version check rather than ignoring the error

Example fix

// before
pip install sgl-kernel==0.0.4  # sglang needs >=0.0.5
// after
pip install -U 'sgl-kernel>=0.0.5'
Defensive patterns

Strategy: validation

Validate before calling

from importlib.metadata import version
from packaging import version as pv
assert pv.parse(version("sgl-kernel")) >= pv.parse(MIN, )

Prevention

When it happens

Trigger: Importing sglang modules that call is_sm90_supported/other kernel-availability checks after downgrading or installing an older sgl-kernel/flashinfer wheel.

Common situations: Mixed-version installs after pip dependency resolution, stale environments after upgrading sglang but not sgl-kernel, or installing CPU/py-only wheels.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/16b5da2b8666b2d6. Report an issue: GitHub.