bndr / pipreqs

pipreqs - Generate pip requirements.txt file based on imports of any project. Looking for maintainers to move this project forward.
Apache License 2.0
6.38k stars 388 forks source link

Pipreqs creates dependency conflict #352

Open philipinf opened 1 year ago

philipinf commented 1 year ago

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