{"record":{"id":"671d271c1484f879","repo":"open-mmlab/mmdetection","slug":"panopticapi-is-not-installed-please-install-it-by-671d27","errorCode":null,"errorMessage":"panopticapi is not installed, please install it by: pip install git+https://github.com/cocodataset/panopticapi.git.","messagePattern":"panopticapi is not installed, please install it by: pip install git\\+https://github\\.com/cocodataset/panopticapi\\.git\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"mmdet/datasets/transforms/loading.py","lineNumber":572,"sourceCode":"            argument for :func:``mmcv.imfrombytes``.\n            See :fun:``mmcv.imfrombytes`` for details.\n            Defaults to 'cv2'.\n        backend_args (dict, optional): Arguments to instantiate the\n            corresponding backend in mmdet >= 3.0.0rc7. Defaults to None.\n    \"\"\"\n\n    def __init__(self,\n                 with_bbox: bool = True,\n                 with_label: bool = True,\n                 with_mask: bool = True,\n                 with_seg: bool = True,\n                 box_type: str = 'hbox',\n                 imdecode_backend: str = 'cv2',\n                 backend_args: dict = None) -> None:\n        try:\n            from panopticapi import utils\n        except ImportError:\n            raise ImportError(\n                'panopticapi is not installed, please install it by: '\n                'pip install git+https://github.com/cocodataset/'\n                'panopticapi.git.')\n        self.rgb2id = utils.rgb2id\n\n        super(LoadPanopticAnnotations, self).__init__(\n            with_bbox=with_bbox,\n            with_label=with_label,\n            with_mask=with_mask,\n            with_seg=with_seg,\n            with_keypoints=False,\n            box_type=box_type,\n            imdecode_backend=imdecode_backend,\n            backend_args=backend_args)\n\n    def _load_masks_and_semantic_segs(self, results: dict) -> None:\n        \"\"\"Private function to load mask and semantic segmentation annotations.\n","sourceCodeStart":554,"sourceCodeEnd":590,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/datasets/transforms/loading.py#L554-L590","documentation":"LoadPanopticAnnotations needs COCO's panopticapi package (specifically utils.rgb2id) to convert RGB panoptic PNGs into instance id maps. Its __init__ imports panopticapi and raises ImportError with a git install URL if unavailable, since panopticapi is not a normal PyPI dependency.","triggerScenarios":"Building a data pipeline containing dict(type='LoadPanopticAnnotations', ...) (panoptic segmentation / maskformer-style configs) when panopticapi is not installed in the environment.","commonSituations":"Running panoptic (PanopticFPN, Mask2Former) configs in a fresh env; installing mmdet via pip which does not pull panopticapi; using forked panopticapi that shadowed the name but failed to import.","solutions":["pip install git+https://github.com/cocodataset/panopticapi.git","Alternatively copy the single panopticapi/utils.py into your project or PYTHONPATH if git access is blocked","Confirm with python -c \"from panopticapi import utils\" before rerunning"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import importlib.util\nif importlib.util.find_spec('panopticapi') is None:\n    raise SystemExit('pip install git+https://github.com/cocodataset/panopticapi.git')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install panopticapi before running any panoptic config","Pin it in requirements with a direct-URL git entry"],"tags":["mmdetection","panopticapi","panoptic-segmentation","missing-dependency","importerror"],"backgroundTag":"missing-optional-dependency","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}