Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pipreqs reporting same module with two versions #434

Open
soulphish opened this issue Feb 12, 2024 · 4 comments
Open

pipreqs reporting same module with two versions #434

soulphish opened this issue Feb 12, 2024 · 4 comments

Comments

@soulphish
Copy link

soulphish commented Feb 12, 2024

I ran pipreqs for the first time, and after fixing some syntax errors it found in my code, it spat out a shorter list than I expected (haven't confirmed anything is missing yet), but what really caught my attention was it repeated two modules with two versions.

Output:

GitPython==3.1.40
GitPython==3.1.41
jsonpickle==3.0.2
numpy==1.26.4
openpyxl==3.1.2
pandas==2.2.0
platformdirs==4.2.0
PyQt5==5.15.10
PyQt5_sip==12.13.0
PySide6==6.6.0
PySide6==6.6.1
PySide6_Addons==6.6.0
PySide6_Essentials==6.6.0
Requests==2.31.0

As you can see, GitPython and PySide6 are both repeated with slightly differing versions.

Output from the terminal:

PS C:\FolderName> pipreqs --force
WARNING: Import named "GitPython" not found locally. Trying to resolve it at the PyPI server.
WARNING: Import named "GitPython" was resolved to "GitPython:3.1.41" package (https://pypi.org/project/GitPython/).
Please, verify manually the final list of requirements.txt to avoid possible dependency confusions.
WARNING: Import named "numpy" not found locally. Trying to resolve it at the PyPI server.
WARNING: Import named "numpy" was resolved to "numpy:1.26.4" package (https://pypi.org/project/numpy/).
Please, verify manually the final list of requirements.txt to avoid possible dependency confusions.
WARNING: Import named "pandas" not found locally. Trying to resolve it at the PyPI server.
WARNING: Import named "pandas" was resolved to "pandas:2.2.0" package (https://pypi.org/project/pandas/).
Please, verify manually the final list of requirements.txt to avoid possible dependency confusions.
WARNING: Import named "platformdirs" not found locally. Trying to resolve it at the PyPI server.
WARNING: Import named "platformdirs" was resolved to "platformdirs:4.2.0" package (https://pypi.org/project/platformdirs/).
Please, verify manually the final list of requirements.txt to avoid possible dependency confusions.
WARNING: Import named "PyQt5" not found locally. Trying to resolve it at the PyPI server.
WARNING: Import named "PyQt5" was resolved to "PyQt5:5.15.10" package (https://pypi.org/project/PyQt5/).
Please, verify manually the final list of requirements.txt to avoid possible dependency confusions.
WARNING: Import named "PySide6" not found locally. Trying to resolve it at the PyPI server.
WARNING: Import named "PySide6" was resolved to "PySide6:6.6.1" package (https://pypi.org/project/PySide6/).
Please, verify manually the final list of requirements.txt to avoid possible dependency confusions.
WARNING: Import named "Requests" not found locally. Trying to resolve it at the PyPI server.
WARNING: Import named "Requests" was resolved to "requests:2.31.0" package (https://pypi.org/project/requests/).
Please, verify manually the final list of requirements.txt to avoid possible dependency confusions.
INFO: Successfully saved requirements file in C:\FolderName\requirements.txt

While it does say "Please, verify manually the final list of requirements.txt to avoid possible dependency confusions." this is repeated for every version it found, so this is not a useful warning. These warnings seem more like normal operation too, not a warning.

@JacobSignal
Copy link

I have a similar issue to the one above, although mine is only for 1 and the version difference is larger than ..1

@yfiua
Copy link

yfiua commented Apr 12, 2024

I have same problem numpy is reported twice.

matplotlib==3.8.2
numpy==1.24.1
numpy==1.21.5
pandas==2.2.2

It should give 1.24.1 which is installed in global. 1.21.5 is in a conda environment that is not even activated

@yfiua
Copy link

yfiua commented Apr 19, 2024

I identified where the problem is. pipreqs will check all directories in sys.path. You can check with

import sys
print(sys.path)

Sometimes you have different versions of packages but python will only use one of them. However pipreqs will report all of them. The fix is easy: just delete the ones not in use.

@Cupcc
Copy link

Cupcc commented May 27, 2024

I identified where the problem is. pipreqs will check all directories in sys.path. You can check with

import sys
print(sys.path)

Sometimes you have different versions of packages but python will only use one of them. However pipreqs will report all of them. The fix is easy: just delete the ones not in use.

Can the actions be done by pipreqs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants