Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ runtime_common = [

srt = [
"sglang[runtime_common]",
"sgl-kernel==0.2.2",
"sgl-kernel==0.2.3",
"torch==2.7.1",
"torchaudio==2.7.1",
"torchvision==0.22.1",
Expand Down
2 changes: 1 addition & 1 deletion python/sglang/srt/entrypoints/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ def _set_envs_and_config(server_args: ServerArgs):
if _is_cuda:
assert_pkg_version(
"sgl-kernel",
"0.2.2",
"0.2.3",
"Please reinstall the latest version with `pip install sgl-kernel --force-reinstall`",
)
Comment on lines 651 to 655
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The pyproject.toml file specifies an exact version for sgl-kernel (==0.2.3), but the assert_pkg_version function only checks for a minimum version (>=0.2.3). This can lead to issues if a future, incompatible version of sgl-kernel is installed.

To ensure consistency and prevent potential runtime errors, the version check should be for an exact match.

I suggest replacing the call to assert_pkg_version with an inline check for the exact version. This makes the check more robust and aligned with the dependency specification.

Suggested change
assert_pkg_version(
"sgl-kernel",
"0.2.2",
"0.2.3",
"Please reinstall the latest version with `pip install sgl-kernel --force-reinstall`",
)
from importlib.metadata import PackageNotFoundError, version
from packaging.version import parse as parse_version
expected_version = "0.2.3"
try:
installed_version = version("sgl-kernel")
if parse_version(installed_version) != parse_version(expected_version):
raise RuntimeError(
f"sgl-kernel version mismatch: installed {installed_version}, expected {expected_version}. "
f"Please reinstall with `pip install sgl-kernel=={expected_version} --force-reinstall`"
)
except PackageNotFoundError:
raise RuntimeError(
f"sgl-kernel not found. Please install version {expected_version} with "
f"`pip install sgl-kernel=={expected_version} --force-reinstall`"
)


Expand Down
Loading