Skip to content

[Bug]: ModuleNotFoundError due to supervision API changeΒ #489

Description

@HatemHassanMohamed

πŸ“Œ Description

The application crashes at runtime due to an import error from the supervision library.
The module supervision.detection.annotate is no longer available in recent versions.

❗ Error Trace

ModuleNotFoundError: No module named 'supervision.detection.annotate'

Traceback:

File "/home/hatem/PerceptionMetrics/app.py", line 385, in <module>
    dataset_viewer_tab()
File "/home/hatem/PerceptionMetrics/tabs/dataset_viewer.py", line 13, in dataset_viewer_tab
    from supervision.detection.annotate import BoxAnnotator

Root Cause

Recent versions of supervision introduced a breaking API change and removed:
supervision.detection.annotate

Classes like BoxAnnotator were moved to the top-level module.

πŸ”§ Suggested Fix
Update the import statement:
Old (deprecated / broken)
from supervision.detection.annotate import BoxAnnotator

New (supported)
from supervision import BoxAnnotator

or:

import supervision as sv

box_annotator = sv.BoxAnnotator()

Workaround
Pin an older version of the library:
pip install supervision==0.6.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions