{"record":{"id":"518aa4ec86771001","repo":"open-mmlab/mmdetection","slug":"panopticapi-is-not-installed-please-install-it-by-518aa4","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":"validation","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"mmdet/evaluation/metrics/coco_panoptic_metric.py","lineNumber":85,"sourceCode":"            names to disambiguate homonymous metrics of different evaluators.\n            If prefix is not provided in the argument, self.default_prefix\n            will be used instead. Defaults to None.\n    \"\"\"\n    default_prefix: Optional[str] = 'coco_panoptic'\n\n    def __init__(self,\n                 ann_file: Optional[str] = None,\n                 seg_prefix: Optional[str] = None,\n                 classwise: bool = False,\n                 format_only: bool = False,\n                 outfile_prefix: Optional[str] = None,\n                 nproc: int = 32,\n                 file_client_args: dict = None,\n                 backend_args: dict = None,\n                 collect_device: str = 'cpu',\n                 prefix: Optional[str] = None) -> None:\n        if panopticapi is None:\n            raise RuntimeError(\n                'panopticapi is not installed, please install it by: '\n                'pip install git+https://github.com/cocodataset/'\n                'panopticapi.git.')\n\n        super().__init__(collect_device=collect_device, prefix=prefix)\n        self.classwise = classwise\n        self.format_only = format_only\n        if self.format_only:\n            assert outfile_prefix is not None, 'outfile_prefix must be not'\n            'None when format_only is True, otherwise the result files will'\n            'be saved to a temp directory which will be cleaned up at the end.'\n\n        self.tmp_dir = None\n        # outfile_prefix should be a prefix of a path which points to a shared\n        # storage when train or test with multi nodes.\n        self.outfile_prefix = outfile_prefix\n        if outfile_prefix is None:\n            self.tmp_dir = tempfile.TemporaryDirectory()","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/evaluation/metrics/coco_panoptic_metric.py#L67-L103","documentation":"CocoPanopticMetric.__init__ requires the unofficial `panopticapi` package (pq_compute from cocodataset) to compute Panoptic Quality. The import is guarded (`panopticapi is None`), and if it's missing the constructor raises RuntimeError with the pip command. Panoptic segmentation eval is impossible without it.","triggerScenarios":"Instantiating CocoPanopticMetric (a panoptic seg val_evaluator) in an environment where `import panopticapi` failed; fresh mmdetection install without the extra panoptic dependency; CI images built from requirements.txt which does not include panopticapi.","commonSituations":"Running a panoptic config (e.g. Panoptic FPN) for the first time; new conda/docker env; panopticapi installed into a different Python env than the one running training.","solutions":["pip install git+https://github.com/cocodataset/panopticapi.git","Verify with `python -c \"import panopticapi\"` in the SAME env used for training","Add the install line to your Dockerfile/CI script so eval jobs have it"],"exampleFix":"# before: RuntimeError on CocoPanopticMetric(...)\n# after\npip install git+https://github.com/cocodataset/panopticapi.git\npython -c 'import panopticapi; print(\"ok\")'","handlingStrategy":"validation","validationCode":"try:\n    import panopticapi  # noqa\n    ok = True\nexcept ImportError:\n    ok = False\nassert ok, 'pip install git+https://github.com/cocodataset/panopticapi.git before panoptic eval'","typeGuard":"def panoptic_eval_available() -> bool:\n    try:\n        import panopticapi  # noqa: F401\n        return True\n    except ImportError:\n        return False","tryCatchPattern":"try:\n    CocoPanopticMetric(...)\nexcept RuntimeError as e:\n    if 'panopticapi' in str(e):\n        subprocess.check_call([sys.executable, '-m', 'pip', 'install',\n            'git+https://github.com/cocodataset/panopticapi.git'])\n    raise","preventionTips":["Install panopticapi in every env/Dockerfile that runs panoptic configs","Guard the import in setup scripts and fail fast with a clear message","Test `import panopticapi` in CI before panoptic eval jobs"],"tags":["mmdetection","panoptic-segmentation","missing-dependency","pip"],"backgroundTag":"missing-python-package","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}