{"record":{"id":"6cb9fc02218c1bc9","repo":"sgl-project/sglang","slug":"deepep-is-not-installed-please-install-deepep-pac","errorCode":null,"errorMessage":"DeepEP is not installed. Please install DeepEP package from https://github.com/deepseek-ai/deepep.","messagePattern":"DeepEP is not installed\\. Please install DeepEP package from https://github\\.com/deepseek-ai/deepep\\.","errorType":"validation","errorClass":"ImportError","httpStatus":null,"severity":"critical","filePath":"python/sglang/srt/layers/moe/token_dispatcher/deepep.py","lineNumber":376,"sourceCode":"        if cls._instance is None:\n            cls._instance = DeepEPConfig()\n        return cls._instance\n\n\nclass _DeepEPDispatcherImplBase:\n    def __init__(\n        self,\n        group: torch.distributed.ProcessGroup,\n        router_topk: int,\n        permute_fusion: bool,\n        num_experts: int,\n        num_local_experts: int,\n        hidden_size: int,\n        params_dtype: torch.dtype,\n        deepep_mode: DeepEPMode,\n    ):\n        if not use_deepep:\n            raise ImportError(\n                \"DeepEP is not installed. Please install DeepEP package from \"\n                \"https://github.com/deepseek-ai/deepep.\"\n            )\n\n        self.group = group\n        self.router_topk = router_topk\n        self.permute_fusion = permute_fusion\n        self.num_experts = num_experts\n        self.num_local_experts = num_local_experts\n        self.hidden_size = hidden_size\n        self.params_dtype = params_dtype\n        self.deepep_mode = deepep_mode\n\n        self.params_bytes = 2\n        # A large value will lead to large memory occupation, thus users should change it accordingly\n        self.num_max_dispatch_tokens_per_rank = (\n            envs.SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK.get()\n        )","sourceCodeStart":358,"sourceCodeEnd":394,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/layers/moe/token_dispatcher/deepep.py#L358-L394","documentation":"DeepEPTokenDispatcher requires the DeepEP package (deepseek-ai/deepep) for expert-parallel communication; constructing it when use_deepep is false — i.e. the import of DeepEP failed at module load — raises this ImportError immediately in __init__. It fires when the server/model config selects deepep (e.g. --moe-a2a-backend deepep) but the wheel isn't installed or importable.","triggerScenarios":"Launching with --moe-a2a-backend deepep (or EP MoE configs that default to deepep) on a node without the deepep Python package, or where deepep failed to import due to missing InfiniBand/NVSHMEM/compilation issues so the use_deepep flag ended up False.","commonSituations":"Running DeepSeek/V3-style EP inference on machines without the deepep wheel; deepep built for a different torch/CUDA/NVSHMEM version; docker images lacking deepep.","solutions":["Install DeepEP: clone https://github.com/deepseek-ai/deepep and build/install matching your torch+CUDA (needs nvshmem and an IB/RDMA-capable or emulated environment); verify `python -c \"import deep_ep\"`","If you don't need EP all-to-all, switch --moe-a2a-backend to none/naive so DeepEPTokenDispatcher is never constructed","Use an SGLang docker image that bundles deepep"],"exampleFix":"# before\npython -m sglang.launch_server ... --moe-a2a-backend deepep\n# ImportError: DeepEP is not installed...\n\n# after\ngit clone https://github.com/deepseek-ai/deepep && cd deepep && pip install -e .\npython -c \"import deep_ep\"  # then relaunch","handlingStrategy":"validation","validationCode":"import importlib.util\nif server_args.moe_a2a_backend == \"deepep\":\n    assert importlib.util.find_spec(\"deep_ep\") is not None, \\\n        \"deepep backend selected but deep_ep not installed; install from deepseek-ai/deepep\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-flight check deep_ep import in launch scripts that use --moe-a2a-backend deepep","Use official SGLang deepep docker images for EP deployments"],"tags":["deepep","moe","import-error","expert-parallel","distributed"],"backgroundTag":"missing-optional-dependency","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}