Skip to content

After installing MegaDetector CLI, modules still missing and unable to run CLI #33

Description

@sunhasgothishaton

Search before asking

  • I have searched the MegaDetector issues and found no similar bug report.

Bug

I installed MegaDetector CLI using the instructions on the page
https://microsoft.github.io/MegaDetector/cli/

I ran megadetector detect --input photo.jpg and it gave the error :

Traceback (most recent call last):
File "/home/eira/Projects/megadetector/bin/megadetector", line 5, in
from megadetector_core.cli import main
File "/home/eira/Projects/megadetector/MegaDetector/src/megadetector_core/init.py", line 18, in
from megadetector_core.detector import MegaDetectorV6, MegaDetectorV5
File "/home/eira/Projects/megadetector/MegaDetector/src/megadetector_core/detector.py", line 8, in
from PytorchWildlife.models import detection as pw_detection
File "/home/eira/Projects/megadetector/lib/python3.12/site-packages/PytorchWildlife/init.py", line 16, in
from .data import *
File "/home/eira/Projects/megadetector/lib/python3.12/site-packages/PytorchWildlife/data/init.py", line 3, in
from .bioacoustics import *
File "/home/eira/Projects/megadetector/lib/python3.12/site-packages/PytorchWildlife/data/bioacoustics/init.py", line 8, in
from .bioacoustics_annotations import AnnotationCreator, BaseReader
File "/home/eira/Projects/megadetector/lib/python3.12/site-packages/PytorchWildlife/data/bioacoustics/bioacoustics_annotations.py", line 3, in
import soundfile as sf
ModuleNotFoundError: No module named 'soundfile'

I fixed this by running pip install soundfile

after running megadetector detect --input photo.jpg again, it gave the error :

Traceback (most recent call last):
File "/home/eira/Projects/megadetector/bin/megadetector", line 5, in
from megadetector_core.cli import main
File "/home/eira/Projects/megadetector/MegaDetector/src/megadetector_core/init.py", line 18, in
from megadetector_core.detector import MegaDetectorV6, MegaDetectorV5
File "/home/eira/Projects/megadetector/MegaDetector/src/megadetector_core/detector.py", line 8, in
from PytorchWildlife.models import detection as pw_detection
File "/home/eira/Projects/megadetector/lib/python3.12/site-packages/PytorchWildlife/init.py", line 16, in
from .data import *
File "/home/eira/Projects/megadetector/lib/python3.12/site-packages/PytorchWildlife/data/init.py", line 3, in
from .bioacoustics import *
File "/home/eira/Projects/megadetector/lib/python3.12/site-packages/PytorchWildlife/data/bioacoustics/init.py", line 11, in
from .bioacoustics_spectrograms import *
File "/home/eira/Projects/megadetector/lib/python3.12/site-packages/PytorchWildlife/data/bioacoustics/bioacoustics_spectrograms.py", line 24, in
import librosa
ModuleNotFoundError: No module named 'librosa'

I fixed this by running pip install librosa

after running megadetector detect --input photo.jpg again, it gave the error :

Traceback (most recent call last):
File "/home/eira/Projects/megadetector/bin/megadetector", line 5, in
from megadetector_core.cli import main
File "/home/eira/Projects/megadetector/MegaDetector/src/megadetector_core/init.py", line 18, in
from megadetector_core.detector import MegaDetectorV6, MegaDetectorV5
File "/home/eira/Projects/megadetector/MegaDetector/src/megadetector_core/detector.py", line 8, in
from PytorchWildlife.models import detection as pw_detection
File "/home/eira/Projects/megadetector/lib/python3.12/site-packages/PytorchWildlife/init.py", line 17, in
from .models import *
File "/home/eira/Projects/megadetector/lib/python3.12/site-packages/PytorchWildlife/models/init.py", line 2, in
from .detection import *
File "/home/eira/Projects/megadetector/lib/python3.12/site-packages/PytorchWildlife/models/detection/init.py", line 1, in
from .ultralytics_based import *
File "/home/eira/Projects/megadetector/lib/python3.12/site-packages/PytorchWildlife/models/detection/ultralytics_based/init.py", line 1, in
from .yolov5_base import *
File "/home/eira/Projects/megadetector/lib/python3.12/site-packages/PytorchWildlife/models/detection/ultralytics_based/yolov5_base.py", line 17, in
from yolov5.utils.general import non_max_suppression, scale_boxes
File "/home/eira/Projects/megadetector/lib/python3.12/site-packages/yolov5/init.py", line 1, in
from yolov5.helpers import YOLOv5
File "/home/eira/Projects/megadetector/lib/python3.12/site-packages/yolov5/helpers.py", line 4, in
from yolov5.models.common import AutoShape, DetectMultiBackend
File "/home/eira/Projects/megadetector/lib/python3.12/site-packages/yolov5/models/common.py", line 28, in
from yolov5.utils.dataloaders import exif_transpose, letterbox
File "/home/eira/Projects/megadetector/lib/python3.12/site-packages/yolov5/utils/dataloaders.py", line 31, in
from yolov5.utils.augmentations import (Albumentations, augment_hsv, classify_albumentations, classify_transforms, copy_paste,
File "/home/eira/Projects/megadetector/lib/python3.12/site-packages/yolov5/utils/augmentations.py", line 15, in
from yolov5.utils.general import LOGGER, check_version, colorstr, resample_segments, segment2box, xywhn2xyxy
File "/home/eira/Projects/megadetector/lib/python3.12/site-packages/yolov5/utils/general.py", line 34, in
import pkg_resources as pkg
ModuleNotFoundError: No module named 'pkg_resources'

When I run pip install pkg_resources, I get the error :

ERROR: Could not find a version that satisfies the requirement pkg_resources (from versions: none)
ERROR: No matching distribution found for pkg_resources

Is there something I can do to get it working?

Environment

  • PytorchWildlife 1.3.0
  • Xubuntu 24.04 LTS
  • Python 3.12.3

Minimal Reproducible Example

Install megadetector CLI using the instructions
https://microsoft.github.io/MegaDetector/cli/

run megadetector detect --input photo.jpg

This produces the results above

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions