Pipreqs creates dependency conflict
- Dominant language
- Python
- Stars
- 7.5k
- Forks
- 424
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to get all dependencies from a directory by using pipreqs. The directory is inside of a virtual env. When I run the command it creates a requirements.txt with the following content:
```
librosa==0.9.2
numpy==1.23.3
pandas==1.5.0
pytz==2022.4
scikit_learn==1.2.1
simplejson==3.18.1
soundfile==0.11.0
torch==1.13.0
torchaudio==0.13.1
torchinfo==1.7.1
torchlibrosa==0.0.9
torchmetrics==0.11.0
tqdm==4.64.1
tsalib==0.2.2
```
When I then try to install the requirements.txt with ``` pip install -r requirements.txt ``` I get the following error:
```
ERROR: Cannot install -r requirements.in (line 9) and torch==1.13.0 because these package versions have conflicting dependencies.
The conflict is caused by:
The user requested torch==1.13.0
torchaudio 0.13.1 depends on torch==1.13.1
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
```
I can manually change the torch version to 1.13.1 and it works and I can install everything. The code also works with these installed dependencies.
My problem is that I want to automate the installation process and I can't resolve these conflicts manually. So my question is, is this a bug within pipreqs or is there a way to resolve this automatically?
I use:
Python 3.8.3
Pipreqs 0.4.11
Thanks for the help in advance
Contributor guide
Research direction
Start by reproducing the pipreqs run with the listed Python and package versions, then inspect the generated requirements.txt and the dependency metadata for torch and torchaudio. Done means establishing whether pipreqs is expected to choose compatible versions or whether this is an unresolved limitation, with the issue behavior documented or covered by an appropriate test if the repository provides one.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100