CameraTraps icon indicating copy to clipboard operation
CameraTraps copied to clipboard

Relative Import Issues

Open mamani828 opened this issue 10 months ago • 2 comments

Search before asking

  • [x] I have searched the Pytorch-Wildlife issues and found no similar bug report.

Bug

When using the relative import of the PytorchWildlife model.py modules and Ultralyrics model.py modules, the relative import on the PytorchWildlife causes this error.

File "/home/usr/anaconda3/envs/animl-gpu-3.8/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/home/usr/anaconda3/envs/animl-gpu-3.8/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/usr/animl-py/src/animl/main.py", line 29, in import PytorchWildlife File "/home/usr/anaconda3/envs/animl-gpu-3.8/lib/python3.8/site-packages/PytorchWildlife/init.py", line 9, in **from .models import *** File "/home/usr/anaconda3/envs/animl-gpu-3.8/lib/python3.8/site-packages/PytorchWildlife/models/init.py", line 2, in from .detection import * File "/home/usr/anaconda3/envs/animl-gpu-3.8/lib/python3.8/site-packages/PytorchWildlife/models/detection/init.py", line 1, in from .ultralytics_based import * File "/home/usr/anaconda3/envs/animl-gpu-3.8/lib/python3.8/site-packages/PytorchWildlife/models/detection/ultralytics_based/init.py", line 1, in from .yolov5_base import * File "/home/usr/anaconda3/envs/animl-gpu-3.8/lib/python3.8/site-packages/PytorchWildlife/models/detection/ultralytics_based/yolov5_base.py", line 17, in from yolov5.utils.general import non_max_suppression, scale_coords File "/home/usr/.local/lib/python3.8/site-packages/yolov5/init.py", line 2, in import yolov5.export as export File "/home/usr/.local/lib/python3.8/site-packages/yolov5/export.py", line 62, in from yolov5.models.yolo import Detect File "/home/usr/.local/lib/python3.8/site-packages/yolov5/models/yolo.py", line 24, in **from models.experimental import *** ModuleNotFoundError: No module named 'models.experimental'

Environment

No response

Minimal Reproducible Example

No response

Additional

No response

Are you willing to submit a PR?

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

mamani828 avatar Feb 10 '25 17:02 mamani828

Hi @mamani828, we have attempted to replicate the issue but PytorchWildlife imports without any issues in our end. However, we suggest trying the following command to ensure you're using a compatible version of YOLOv5:

pip install yolov5==6.2

If this does not resolve the issue, could you please provide us with a detailed step-by-step process of your installation? This will help us to replicate the scenario more accurately and assist you better. Thank you!

danielaruizl1 avatar Feb 18 '25 04:02 danielaruizl1

Had similar issues to the original post. Re-installing YOLOv5 to 6.2 resolved the issue. @danielaruizl1 Thanks for the instruction.

NetZissou avatar Mar 09 '25 15:03 NetZissou

We will be closing this issue since there are no comments for the past 3 months. If the solution suggested by @danielaruizl1 does not work, feel free to re-open this issue!

aa-hernandez avatar Jul 01 '25 21:07 aa-hernandez