open-mmlab/mmdetection · error · RuntimeError
lap is not installed, please install it by:
Error message
lap is not installed, please install it by: pip install lap
What it means
BYTETracker associates detections to tracks with linear assignment provided by the optional 'lap' package. If the lap import failed, constructing ByteTrack raises RuntimeError.
Source
Thrown at mmdet/models/trackers/byte_tracker.py:53
- low (float): Threshold of the second matching. Defaults to 0.5.
- tentative (float): Threshold of the matching for tentative
tracklets. Defaults to 0.3.
num_tentatives (int, optional): Number of continuous frames to confirm
a track. Defaults to 3.
"""
def __init__(self,
motion: Optional[dict] = None,
obj_score_thrs: dict = dict(high=0.6, low=0.1),
init_track_thr: float = 0.7,
weight_iou_with_det_scores: bool = True,
match_iou_thrs: dict = dict(high=0.1, low=0.5, tentative=0.3),
num_tentatives: int = 3,
**kwargs):
super().__init__(**kwargs)
if lap is None:
raise RuntimeError('lap is not installed,\
please install it by: pip install lap')
if motion is not None:
self.motion = TASK_UTILS.build(motion)
self.obj_score_thrs = obj_score_thrs
self.init_track_thr = init_track_thr
self.weight_iou_with_det_scores = weight_iou_with_det_scores
self.match_iou_thrs = match_iou_thrs
self.num_tentatives = num_tentatives
@property
def confirmed_ids(self) -> List:
"""Confirmed ids in the tracker."""
ids = [id for id, track in self.tracks.items() if not track.tentative]
return ids
View on GitHub (pinned to cfd5d3a985)
Solutions
- pip install lap
- If the source build fails on Windows, install a prebuilt wheel: pip install lap -f https://github.com/gatagat/lap/releases or use conda
- Verify with python -c 'import lap' in the same interpreter as training
Example fix
# before: RuntimeError: lap is not installed # after pip install lap
Defensive patterns
Strategy: validation
Validate before calling
import importlib.util
if importlib.util.find_spec('lap') is None:
raise SystemExit('pip install lap') Try / catch
try:
tracker = ByteTracker(...)
except RuntimeError as e:
if 'lap' in str(e):
raise SystemExit('Missing dependency: pip install lap')
raise Prevention
- Install tracking extras before running MOT configs
- Pin a lap version that has prebuilt wheels for your platform
When it happens
Trigger: Building BYTETracker (tracker=dict(type='ByteTrack', ...)) in an environment where 'import lap' fails or lap is not installed.
Common situations: Running MOT configs (bytetrack_yolox_x_8xb4-80e_mot17half...) after a base mmdet install; lap needs a C compiler and can fail to build on Windows or older pip.
Related errors
- lap is not installed, please install it by:
- trackeval is not installed,please install it by: pip install
- sscikit-learn is not installed, please insta
- sscikit-learn is not installed, please insta
- motmetrics is not installed, please install
AI-assisted analysis of open-mmlab/mmdetection@cfd5d3a985 (2026-08-27).
Data as JSON: /api/errors/fb054e977871fe0b.
Report an issue: GitHub.