Repository navigation
fix(deps): make a fresh pip install importable with PytorchWildlife 1.3.1 - #8
Open
Zhongqi Miao (zhmiao) wants to merge 1 commit into
Open
Zhongqi Miao (zhmiao) wants to merge 1 commit into
Zhongqi Miao (zhmiao) wants to merge 1 commit into
Conversation
….3.1 PytorchWildlife 1.3.1, its final release, cannot be imported from a clean pip install: - it imports soundfile and librosa at package load but does not declare them; - its yolov5 dependency imports pkg_resources, which setuptools removed in 82.0.0. Add soundfile and librosa, and cap setuptools below 82, so the documented `pip install -r requirements.txt` gives a working main.py. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: cf871bd7-3efa-4dad-8dd6-c61e46669a42
This was referenced Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The README's pip install path (
pip install -r requirements.txt) gives an environment wherepython main.py --helpfails at import.main.pyimportssrc/utils/batch_detection_cropping.py, which importsPytorchWildlife, and PytorchWildlife 1.3.1 (its final release) cannot be imported from a clean install. A fresh Python 3.11 venv failed in this order:ModuleNotFoundError: No module named 'soundfile', fromPytorchWildlife/data/bioacoustics/bioacoustics_annotations.py.ModuleNotFoundError: No module named 'librosa', fromPytorchWildlife/data/bioacoustics/bioacoustics_spectrograms.py.ModuleNotFoundError: No module named 'pkg_resources', fromyolov5/utils/general.py.pkg_resources; 82.0.0 does not. Both were checked in this venv.setuptools, so pip resolves the latest release (84.2.1).PytorchWildlife is retired, so this cannot be fixed upstream. This repo has to declare the gaps itself.
What
requirements.txtgains:environment.yamlis unchanged. It is a frozen Python 3.8 snapshot withpytorchwildlife==1.0.1.1andsetuptools=69.0.3, so it does not hit these errors.Trade-off to decide
setuptools<82resolves to 81.0.0, which is inside the affected range of two open advisories:Both affect packaging and install steps, not the training code at runtime. Dependabot will likely flag the pin.
Alternatives considered:
src/utils/batch_detection_cropping.py. This fixes--helpand--predictonly. Every train, val, and test run still callsbatch_detection_cropping()(main.py, theif not conf.predict:block), which imports PytorchWildlife and yolov5, so the cap would still be needed for training.sparrow-engine. This removes PytorchWildlife and the cap entirely. It is a larger change and belongs in its own PR.If you prefer the port, close this PR.
How it was tested
In a fresh Python 3.11 venv (CPU torch,
uv pip install -r requirements.txt), the resolver picked:python main.py --helpexits 0. Without the four new lines, the same install fails with the errors listed above.Independent of #7 (safe YAML loading and GPU list validation); the two PRs touch different files.