{"record":{"id":"70e7c933f85e9418","repo":"sgl-project/sglang","slug":"mori-umbp-is-not-available-build-mori-with-build","errorCode":null,"errorMessage":"mori.umbp is not available. Build mori with BUILD_UMBP=ON or fall back to the default torch host allocator.","messagePattern":"mori\\.umbp is not available\\. Build mori with BUILD_UMBP=ON or fall back to the default torch host allocator\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"python/sglang/srt/mem_cache/storage/umbp/umbp_host_allocator.py","lineNumber":34,"sourceCode":"    if raw is None:\n        return default\n    return raw.strip().lower() in (\"1\", \"true\", \"yes\", \"on\")\n\n\ndef _int_env(name: str, default: int) -> int:\n    raw = os.getenv(name)\n    return int(raw) if raw is not None and raw != \"\" else default\n\n\nclass UMBPHostTensorAllocator(HostTensorAllocator):\n    \"\"\"Allocate the HiCache L2 host tensor from mori's UMBPHostMemAllocator.\"\"\"\n\n    def __init__(self) -> None:\n        super().__init__()\n        try:\n            import mori.umbp as umbp_mod\n        except ImportError as exc:\n            raise RuntimeError(\n                \"mori.umbp is not available. Build mori with BUILD_UMBP=ON \"\n                \"or fall back to the default torch host allocator.\"\n            ) from exc\n\n        self._mod = umbp_mod\n        self._allocator = umbp_mod.UMBPHostMemAllocator()\n\n        self._use_hugepage = _bool_env(\"SGLANG_HICACHE_HOST_HUGEPAGE\", True)\n        self._hugepage_size = _int_env(\n            \"SGLANG_HICACHE_HOST_HUGEPAGE_SIZE\", 2 * 1024 * 1024\n        )\n        self._numa_node = _int_env(\"SGLANG_HICACHE_HOST_NUMA_NODE\", -1)\n        self._prefault = _bool_env(\"SGLANG_HICACHE_HOST_PREFAULT\", True)\n        self._handles: Dict[int, Any] = {}\n\n    def allocate(\n        self, dims: tuple, dtype: torch.dtype, device: str = \"cpu\"\n    ) -> torch.Tensor:","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/mem_cache/storage/umbp/umbp_host_allocator.py#L16-L52","documentation":"UMBP host allocator requires the native mori.umbp module; importing it failed, so the allocator cannot run. mori must be built with BUILD_UMBP=ON or you must use the default torch host allocator.","triggerScenarios":"Instantiating UMBPHostTensorAllocator when mori is not installed or was built without the UMBP extension (import mori.umbp raises ImportError).","commonSituations":"Using the UMBP storage backend (--storage-backend umbp or similar) with a stock/older mori wheel that lacks umbp; missing LD_LIBRARY_PATH for the shared object.","solutions":["Install/rebuild mori with BUILD_UMBP=ON (pip install with the right build flags or use the provided wheel)","If you don't need UMBP hugepage/NUMA features, fall back to the default torch host allocator","Verify 'python -c \"import mori.umbp\"' succeeds in the serving environment"],"exampleFix":"# before\nalloc = UMBPHostTensorAllocator()\n# after\ntry:\n    import mori.umbp  # noqa\n    alloc = UMBPHostTensorAllocator()\nexcept ImportError:\n    alloc = None  # fall back to default torch host allocator","handlingStrategy":"fallback","validationCode":"try:\n    import mori.umbp  # noqa: F401\n    UMBP_OK = True\nexcept ImportError:\n    UMBP_OK = False\nif not UMBP_OK:\n    # configure default torch host allocator instead\n    pass","typeGuard":"def umbp_available() -> bool:\n    try:\n        import mori.umbp  # noqa: F401\n        return True\n    except ImportError:\n        return False","tryCatchPattern":"try:\n    alloc = UMBPHostTensorAllocator()\nexcept RuntimeError:\n    logger.warning('mori.umbp missing; using default host allocator')\n    alloc = None  # default allocator path","preventionTips":["Add a startup capability probe for mori.umbp before selecting the UMBP backend","Document the BUILD_UMBP=ON requirement in deployment docs","Containerize the serving image with a prebuilt mori wheel including umbp"],"tags":["import-error","umbp","mori","native-dependency"],"backgroundTag":"missing-optional-dependency","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}