{"record":{"id":"b845a9ed102f8048","repo":"sgl-project/sglang","slug":"please-install-diso-via-pip-install-diso-or-set","errorCode":null,"errorMessage":"Please install diso via `pip install diso`, or set mc_algo to 'mc'","messagePattern":"Please install diso via `pip install diso`, or set mc_algo to 'mc'","errorType":"validation","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/vaes/hunyuan3d_vae.py","lineNumber":1084,"sourceCode":"        grid_size, bbox_min, bbox_size = self._compute_box_stat(\n            bounds, octree_resolution\n        )\n        vertices = vertices / grid_size * bbox_size + bbox_min\n        return vertices, faces\n\n\nclass DMCSurfaceExtractor(SurfaceExtractor):\n    \"\"\"Differentiable Marching Cubes surface extractor.\"\"\"\n\n    def run(self, grid_logit, *, octree_resolution, **kwargs):\n        device = grid_logit.device\n        if not hasattr(self, \"dmc\"):\n            try:\n                from diso import DiffDMC\n\n                self.dmc = DiffDMC(dtype=torch.float32).to(device)\n            except ImportError:\n                raise ImportError(\n                    \"Please install diso via `pip install diso`, or set mc_algo to 'mc'\"\n                )\n        sdf = -grid_logit / octree_resolution\n        sdf = sdf.to(torch.float32).contiguous()\n        verts, faces = self.dmc(sdf, deform=None, return_quads=False, normalize=True)\n        verts = center_vertices(verts)\n        vertices = verts.detach().cpu().numpy()\n        faces = faces.detach().cpu().numpy()[:, ::-1]\n        return vertices, faces\n\n\nSurfaceExtractors = {\n    \"mc\": MCSurfaceExtractor,\n    \"dmc\": DMCSurfaceExtractor,\n}\n\n\nclass VectsetVAE(nn.Module, LayerwiseOffloadableModuleMixin):","sourceCodeStart":1066,"sourceCodeEnd":1102,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/vaes/hunyuan3d_vae.py#L1066-L1102","documentation":"DMCSurfaceExtractor.run lazily imports the diso package (DiffDMC, differentiable marching cubes) on first use. If diso is not installed in the environment, the ImportError is caught and re-raised with this actionable message. The marching-cubes-alternative is the pure-Python skimage-based MCSurfaceExtractor, selectable via mc_algo='mc'.","triggerScenarios":"Constructing or calling DMCSurfaceExtractor (mc_algo='dmc' / default when FlashVDM decoding is enabled via enable_flashvdm_decoder) in an environment where `import diso` fails — either the package is missing or its CUDA extension failed to build/load.","commonSituations":"Running Hunyuan3D VAE mesh extraction without installing the diso dependency; diso installed for a different torch/CUDA version so the import raises ImportError on extension load; lightweight CPU-only deployments that never needed diso before enabling FlashVDM.","solutions":["pip install diso (needs a CUDA toolchain and matching torch version to compile the extension)","Or switch to marching cubes: pass mc_algo='mc' when enabling the decoder so MCSurfaceExtractor (scikit-image) is used","Verify the install with `python -c \"from diso import DiffDMC\"` and check the torch/CUDA version match if it still fails","Ensure scikit-image is installed if you fall back to mc"],"exampleFix":"// before\nextractor = DMCSurfaceExtractor()\nmesh = extractor(grid_logits)  # ImportError\n\n// after\nextractor = MCSurfaceExtractor()\nmesh = extractor(grid_logits, mc_level=0.0, bounds=bounds, octree_resolution=resolution)","handlingStrategy":"fallback","validationCode":"try:\n    from diso import DiffDMC  # noqa: F401\n    mc_algo = 'dmc'\nexcept ImportError:\n    mc_algo = 'mc'  # skimage-based fallback, requires scikit-image\nimport skimage  # ensure fallback dependency present","typeGuard":null,"tryCatchPattern":"try:\n    mesh = dmc_extractor(grid_logits, octree_resolution=res)\nexcept ImportError as e:\n    if 'diso' in str(e):\n        mesh = mc_extractor(grid_logits, mc_level=0.0, bounds=bounds, octree_resolution=res)\n    else:\n        raise","preventionTips":["Pre-install diso with a torch/CUDA-matched toolchain before enabling dmc","Or configure mc_algo='mc' and install scikit-image","Verify with `python -c \"from diso import DiffDMC\"` at deploy time"],"tags":["python","import-error","missing-dependency","diso","marching-cubes","hunyuan3d"],"backgroundTag":"missing-optional-dependency","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}