{"record":{"id":"061448f41592523f","repo":"open-mmlab/mmdetection","slug":"panopticapi-is-not-installed-please-install-it-by-061448","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":"RuntimeError","httpStatus":null,"severity":"error","filePath":"mmdet/evaluation/functional/panoptic_utils.py","lineNumber":53,"sourceCode":"                           backend_args=None,\n                           print_log=False):\n    \"\"\"The single core function to evaluate the metric of Panoptic\n    Segmentation.\n\n    Same as the function with the same name in `panopticapi`. Only the function\n    to load the images is changed to use the file client.\n\n    Args:\n        proc_id (int): The id of the mini process.\n        gt_folder (str): The path of the ground truth images.\n        pred_folder (str): The path of the prediction images.\n        categories (str): The categories of the dataset.\n        backend_args (object): The Backend of the dataset. If None,\n            the backend will be set to `local`.\n        print_log (bool): Whether to print the log. Defaults to False.\n    \"\"\"\n    if PQStat 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    pq_stat = PQStat()\n\n    idx = 0\n    for gt_ann, pred_ann in annotation_set:\n        if print_log and idx % 100 == 0:\n            print('Core: {}, {} from {} images processed'.format(\n                proc_id, idx, len(annotation_set)))\n        idx += 1\n        # The gt images can be on the local disk or `ceph`, so we use\n        # backend here.\n        img_bytes = get(\n            os.path.join(gt_folder, gt_ann['file_name']),\n            backend_args=backend_args)\n        pan_gt = mmcv.imfrombytes(img_bytes, flag='color', channel_order='rgb')","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/evaluation/functional/panoptic_utils.py#L35-L71","documentation":"pq_compute_single_core implements COCO panoptic quality computation and needs the official panopticapi library (PQStat). If the import failed, PQStat is None and RuntimeError is raised with install instructions.","triggerScenarios":"Running PanopticMetric / pq_compute_single_core without `pip install git+https://github.com/cocodataset/panopticapi.git`.","commonSituations":"Panoptic segmentation evaluation in minimal envs; panopticapi is not on PyPI in all versions so it's often missing from requirements.","solutions":["pip install git+https://github.com/cocodataset/panopticapi.git","Verify: python -c \"from panopticapi.evaluation import PQStat\"","Add the package to your environment/CI requirements when panoptic eval is used"],"exampleFix":"# before\npq_compute_single_core(...)  # RuntimeError\n# after\n# after installing panopticapi:\npq_compute_single_core(...)","handlingStrategy":"validation","validationCode":"try:\n    from panopticapi.evaluation import PQStat  # noqa\nexcept ImportError:\n    raise SystemExit('pip install git+https://github.com/cocodataset/panopticapi.git')","typeGuard":null,"tryCatchPattern":"try:\n    pq_compute_single_core(...)\nexcept RuntimeError as e:\n    if 'panopticapi' in str(e):\n        raise SystemExit('Install panopticapi first')\n    raise","preventionTips":["Add panopticapi to requirements for panoptic eval pipelines","Test the import in docker build stage"],"tags":["panoptic","missing-dependency","mmdetection","evaluation"],"backgroundTag":"missing-optional-dependency","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}