{"record":{"id":"dc8a61ef0aea2978","repo":"open-mmlab/mmdetection","slug":"motmetrics-is-not-installed-pleas","errorCode":null,"errorMessage":"motmetrics is not installed,                 please install it by: pip install motmetrics","messagePattern":"motmetrics is not installed,                 please install it by: pip install motmetrics","errorType":"error_code","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"mmdet/models/trackers/sort_tracker.py","lineNumber":58,"sourceCode":"        match_iou_thr (float, optional): Threshold of the IoU matching process.\n            Defaults to 0.7.\n        num_tentatives (int, optional): Number of continuous frames to confirm\n            a track. Defaults to 3.\n    \"\"\"\n\n    def __init__(self,\n                 motion: Optional[dict] = None,\n                 obj_score_thr: float = 0.3,\n                 reid: dict = dict(\n                     num_samples=10,\n                     img_scale=(256, 128),\n                     img_norm_cfg=None,\n                     match_score_thr=2.0),\n                 match_iou_thr: float = 0.7,\n                 num_tentatives: int = 3,\n                 **kwargs):\n        if motmetrics is None:\n            raise RuntimeError('motmetrics is not installed,\\\n                 please install it by: pip install motmetrics')\n        super().__init__(**kwargs)\n        if motion is not None:\n            self.motion = TASK_UTILS.build(motion)\n            assert self.motion is not None, 'SORT/Deep SORT need KalmanFilter'\n        self.obj_score_thr = obj_score_thr\n        self.reid = reid\n        self.match_iou_thr = match_iou_thr\n        self.num_tentatives = num_tentatives\n\n    @property\n    def confirmed_ids(self) -> List:\n        \"\"\"Confirmed ids in the tracker.\"\"\"\n        ids = [id for id, track in self.tracks.items() if not track.tentative]\n        return ids\n\n    def init_track(self, id: int, obj: Tuple[Tensor]) -> None:\n        \"\"\"Initialize a track.\"\"\"","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/trackers/sort_tracker.py#L40-L76","documentation":"SORTTracker uses motmetrics (py-motmetrics) for its utils/association path; if the package failed to import at module load, constructing SORT raises RuntimeError before any tracking happens.","triggerScenarios":"tracker=dict(type='SORTTracker') or DeepSORTTracker construction without motmetrics installed.","commonSituations":"Running MOT tracking configs (sort, deepsort) after a base install; motmetrics is an optional runtime extra of mmdet.","solutions":["pip install motmetrics","Verify import in the active env: python -c 'import motmetrics'","Also ensure lap and scipy are present since SORT trackers need them too"],"exampleFix":"# before: RuntimeError: motmetrics is not installed\n# after\npip install motmetrics","handlingStrategy":"validation","validationCode":"import importlib.util\nassert importlib.util.find_spec('motmetrics'), 'pip install motmetrics'","typeGuard":null,"tryCatchPattern":"try:\n    tracker = SORTTracker(...)\nexcept RuntimeError as e:\n    if 'motmetrics' in str(e):\n        raise SystemExit('Missing dependency: pip install motmetrics')\n    raise","preventionTips":["Install motmetrics alongside lap and scipy for MOT work","Keep tracking configs in envs with the full extras installed"],"tags":["mmdetection","tracking","sort","missing-dependency","motmetrics"],"backgroundTag":"missing-python-package","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}