sgl-project/sglang · error · ImportError
The Helion package is required when a KDA backend is set to
Error message
The Helion package is required when a KDA backend is set to Helion. Install it with: pip install helion==1.4.0
What it means
HelionKDAKernel imports the helion JIT package when either decode or prefill is enabled; if helion is absent, __init__ raises ImportError pinning the required version (1.4.0).
Source
Thrown at python/sglang/srt/layers/attention/linear/kernels/kda_helion.py:41
def __init__(
self,
triton_fallback: TritonKDAKernel | None = None,
*,
enable_decode: bool = True,
enable_prefill: bool = True,
) -> None:
self.supports_packed_decode = enable_decode
self._packed_decode = None
self._replayssm_decode = None
self._chunk_kda = None
if enable_decode or enable_prefill:
try:
import helion # noqa: F401
except ModuleNotFoundError as error:
if error.name != "helion":
raise
raise ImportError(
"The Helion package is required when a KDA backend is set to "
"Helion. Install it with: pip install helion==1.4.0"
) from None
if enable_decode:
from sglang.kernels.ops.attention.helion.kda_decode import (
helion_fused_recurrent_kda_packed_decode,
)
from sglang.kernels.ops.attention.helion.kda_replayssm import (
helion_fused_recurrent_kda_replayssm_decode,
)
self._packed_decode = helion_fused_recurrent_kda_packed_decode
self._replayssm_decode = helion_fused_recurrent_kda_replayssm_decode
if enable_prefill:
from sglang.kernels.ops.attention.helion.kda_prefill import chunk_kda
self._chunk_kda = chunk_kda
self._triton = triton_fallback or TritonKDAKernel()View on GitHub (pinned to 0132848349)
Solutions
- pip install helion==1.4.0
- Fall back to triton backend if helion cannot be installed
- Verify the install with python -c 'import helion' before launching the server
Example fix
# before # helion not installed # after pip install helion==1.4.0
Defensive patterns
Strategy: try-catch
Validate before calling
try:
import helion
helion_ok = True
except ModuleNotFoundError:
helion_ok = False
if not helion_ok:
linear_attn_backend = 'triton' Type guard
null
Try / catch
try:
kernel = HelionKDAKernel(enable_decode=True, enable_prefill=True)
except ImportError as e:
logger.warning('%s; falling back to triton KDA', e)
kernel = TritonKDAKernel() Prevention
- Pin helion==1.4.0 in requirements when using the helion backend
- Smoke-test 'import helion' in container builds
When it happens
Trigger: Selecting helion as a KDA backend (decode and/or prefill) in an environment without the helion package installed.
Common situations: New environment or minimal Docker image without helion; version drift where helion is present but the import of the exact module fails with name 'helion'.
Related errors
- The 'flashkda' KDA prefill backend requires the flash_kda mo
- `mixed_qkv` must be a 2D tensor (got ndim={mixed_qkv.ndim}).
- `mixed_qkv` must be contiguous in the last dim.
- `a` and `b` must be 2D tensors (got a.ndim={a.ndim}, b.ndim=
- `a`/`b` must be contiguous in the last dim.
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/d0373910e10ff17b.
Report an issue: GitHub.