{"record":{"id":"cb6f2c571969778e","repo":"open-mmlab/mmdetection","slug":"sscikit-learn-is-not-installed-pl","errorCode":null,"errorMessage":"sscikit-learn is not installed,                 please install it by: pip install scikit-learn","messagePattern":"sscikit-learn is not installed,                 please install it by: pip install scikit-learn","errorType":"error_code","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"mmdet/models/task_modules/tracking/interpolation.py","lineNumber":34,"sourceCode":"    \"\"\"Interpolate tracks to make tracks more complete.\n\n    Args:\n        min_num_frames (int, optional): The minimum length of a track that will\n            be interpolated. Defaults to 5.\n        max_num_frames (int, optional): The maximum disconnected length in\n            a track. Defaults to 20.\n        use_gsi (bool, optional): Whether to use the GSI (Gaussian-smoothed\n            interpolation) method. Defaults to False.\n        smooth_tau (int, optional): smoothing parameter in GSI. Defaults to 10.\n    \"\"\"\n\n    def __init__(self,\n                 min_num_frames: int = 5,\n                 max_num_frames: int = 20,\n                 use_gsi: bool = False,\n                 smooth_tau: int = 10):\n        if not HAS_SKIKIT_LEARN:\n            raise RuntimeError('sscikit-learn is not installed,\\\n                 please install it by: pip install scikit-learn')\n        self.min_num_frames = min_num_frames\n        self.max_num_frames = max_num_frames\n        self.use_gsi = use_gsi\n        self.smooth_tau = smooth_tau\n\n    def _interpolate_track(self,\n                           track: np.ndarray,\n                           track_id: int,\n                           max_num_frames: int = 20) -> np.ndarray:\n        \"\"\"Interpolate a track linearly to make the track more complete.\n\n        This function is proposed in\n        \"ByteTrack: Multi-Object Tracking by Associating Every Detection Box.\"\n        `ByteTrack<https://arxiv.org/abs/2110.06864>`_.\n\n        Args:\n            track (ndarray): With shape (N, 7). Each row denotes","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/task_modules/tracking/interpolation.py#L16-L52","documentation":"The TrackletInterpolator (used for video instance/seg tracking interpolation between sparse keyframes) requires Gaussian-smoothed interpolation backed by scikit-learn. At import time mmdet tries to import sklearn; if it is missing, HAS_SKIKIT_LEARN is False and __init__ raises RuntimeError.","triggerScenarios":"Instantiating TrackletInterpolator with use_gsi=True workflows or simply constructing it in any environment where 'import sklearn' failed (extra deps not installed).","commonSituations":"Installing mmdet with minimal deps (pip install mmdet without [extra]) and then running video tracking / VIS configs (e.g. Mask2Former video) that build this module.","solutions":["pip install scikit-learn","Or verify with 'python -c \"import sklearn\"' that it's importable in the same env as mmdet","If using conda: conda install -c conda-forge scikit-learn"],"exampleFix":"# before: RuntimeError: scikit-learn is not installed\n# after\npip install scikit-learn","handlingStrategy":"validation","validationCode":"try:\n    import sklearn  # noqa\n    ok = True\nexcept ImportError:\n    ok = False\nassert ok, 'pip install scikit-learn before using tracking interpolation'","typeGuard":null,"tryCatchPattern":"try:\n    interp = TrackletInterpolator(...)\nexcept RuntimeError as e:\n    if 'scikit-learn' in str(e):\n        raise SystemExit('Missing dependency: run pip install scikit-learn')\n    raise","preventionTips":["Install extras upfront: pip install mmdet[mot]","Check optional imports before building tracking configs"],"tags":["mmdetection","tracking","missing-dependency","scikit-learn"],"backgroundTag":"missing-python-package","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}