microsoft / CameraTraps

PyTorch Wildlife: a Collaborative Deep Learning Framework for Conservation.
https://cameratraps.readthedocs.io/en/latest/
MIT License
781 stars 246 forks source link

no module named detection error #323

Closed rbcer17 closed 2 years ago

rbcer17 commented 2 years ago

Hi, I get an error message when running the following command

python /home/ubuntu/notebooks/CameraTraps/detection/run_detector_batch.py /home/ubuntu/notebooks/md_v5a.0.0.pt "$images_dir" "$output_file_path" --recursive --output_relative_filenames --quiet

the error is: Traceback (most recent call last): File "/home/ubuntu/notebooks/CameraTraps/detection/run_detector_batch.py", line 69, in from detection.run_detector import ImagePathUtils, is_gpu_available,\ ModuleNotFoundError: No module named 'detection'

Can you help? thanks!

agentmorris commented 2 years ago

The quick fix is that all of our scripts expect the "CameraTraps" folder to be in your PYTHONPATH environment variable, so that when a script does "from detection.something import something_else", Python can find the "detection" folder.

You can run:

export PYTHONPATH="$PYTHONPATH:/home/ubuntu/notebooks/CameraTraps"

...to add that folder to your PYTHONPATH.

But the longer fix is that we really encourage you to follow the setup instructions as closely as possible. Even if you get through this immediate issue with the "detection" folder, there are a few other details that are expected in the environment, and YMMV if you set things up outside of the recommended process.

Hope that helps!

rbcer17 commented 2 years ago

Thank you, it worked!