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

BUG: not able to detect local packages #444

Open
yfiua opened this issue Apr 12, 2024 · 9 comments
Open

BUG: not able to detect local packages #444

yfiua opened this issue Apr 12, 2024 · 9 comments

Comments

@yfiua
Copy link

yfiua commented Apr 12, 2024

I have pandas installed

> pip list | grep pandas
pandas                        2.2.0

but pipreqs is not able to detect it and tries to resolve it via PyPI. Why?

> pipreqs . --print

INFO: Not scanning for jupyter notebooks.
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.2" package (https://pypi.org/project/pandas/).
Please, verify manually the final list of requirements.txt to avoid possible dependency confusions.
matplotlib==3.8.2
numpy==1.24.1
numpy==1.21.5
pandas==2.2.2
INFO: Successfully output requirements
@yfiua yfiua changed the title BUG: nt BUG: not able to detect local packages Apr 12, 2024
@AhmetZamanis
Copy link

@yfiua I had the same "Not scanning for jupyter notebooks" warning, and around half of the imported packages were missing. You need the following command, which enables scanning of Jupyter notebooks:

pipreqs --scan-notebooks .

After adding this option, I still get the "not found locally" warning for a few packages, but the resulting requirements.txt file is complete and correct, except for the pandas version. I have pandas 2.2.1 installed, but pipreqs lists 2.2.2 in the generated file.

The warning messages I get are below for the devs' reference, if needed:

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.2" package (https://pypi.org/project/pandas/).
Please, verify manually the final list of requirements.txt to avoid possible dependency confusions.
WARNING: Import named "seaborn" not found locally. Trying to resolve it at the PyPI server.
WARNING: Import named "seaborn" was resolved to "seaborn:0.13.2" package (https://pypi.org/project/seaborn/).
Please, verify manually the final list of requirements.txt to avoid possible dependency confusions.
INFO: Successfully saved requirements file in .\requirements.txt

@yfiua
Copy link
Author

yfiua commented Apr 16, 2024

For me it is not related to --scan-notebooks because I have no notebooks. Adding --scan-notebooks does not solve the problem

@AhmetZamanis
Copy link

I see, I assumed the warning is only displayed when there are notebooks in the project. My mistake.

@sergedv2024
Copy link

I have the same problem, it recognise well some packages but not polars niether pandas

@VishalSharmaCode
Copy link

Use conda install anaconda::pandas command into jupyter command terminal

@yfiua
Copy link
Author

yfiua commented May 9, 2024

Use conda install anaconda::pandas command into jupyter command terminal

The issue is not related to conda, nor jupyter. pipreqs should work without conda or jupyter.

@phgas
Copy link

phgas commented Jul 16, 2024

Same issue here, was anyone able to solve it?

@itanfeng
Copy link

Same problem. The versions are not match. It always generates the package's version through resolving the the PyPI server instead of the ture local package's version.

@normanius
Copy link

normanius commented Nov 1, 2024

I also observe this problem.

For an arbitrary project, I call

pipreqs path/to/project --savepath="req.txt"

I get the warnings:

...
WARNING: Import named "scipy" not found locally. Trying to resolve it at the PyPI server.
WARNING: Import named "scipy" was resolved to "scipy:1.14.1" package (https://pypi.org/project/scipy/).
Please, verify manually the final list of requirements.txt to avoid possible dependency confusions.
WARNING: Import named "seaborn" not found locally. Trying to resolve it at the PyPI server.
WARNING: Import named "seaborn" was resolved to "seaborn:0.13.2" package (https://pypi.org/project/seaborn/).
Please, verify manually the final list of requirements.txt to avoid possible dependency confusions.
...

I have a modified PYTHONPATH, and I use pyenv... In case this is relevant for debugging...

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

7 participants