pipreqs icon indicating copy to clipboard operation
pipreqs copied to clipboard

Wrongly capitalizes module name: "Requests"

Open Michal-Martinek opened this issue 4 months ago • 1 comments

here's my command:

>>> pipreqs . --force --encoding=utf-8 --mode no-pin --debug
DEBUG: Found packages: {'time', 'subprocess', 'urllib', 'sys', 'typing', 'requests', 'logging', 'os', 'base64', 'traceback', 'webbrowser', 'linecache', 'json', 'csv', 'tqdm', 'socketserver', 'datetime', 'concurrent', 'collections', 'math', 'http', 'glob', 'cProfile', 'pstats'}
DEBUG: Found imports: Requests, tqdm
DEBUG: Getting packages information from Local/PyPI
WARNING: Import named "Requests" not found locally. Trying to resolve it at the PyPI server.
DEBUG: Starting new HTTPS connection (1): pypi.python.org:443
DEBUG: https://pypi.python.org:443 "GET /pypi/Requests/json HTTP/11" 301 122
DEBUG: Starting new HTTPS connection (1): pypi.org:443
DEBUG: https://pypi.org:443 "GET /pypi/requests/json HTTP/11" 200 37837
WARNING: Import named "Requests" was resolved to "requests:2.32.5" package (https://pypi.org/project/requests/).
Please, verify manually the final list of requirements.txt to avoid possible dependency confusions.
DEBUG: Writing 2 requirements: Requests, tqdm to .\requirements.txt
INFO: Successfully saved requirements file in .\requirements.txt

it for some reason tries to resolve "Requests" with a capital, not "requests" I checked my code, i used "Requests" nowhere, only the standart import requests. Even after nuking "requirements.txt" and trying again (with pretty much any set of arguments) is does the same.

environment

Michal-Martinek avatar Sep 02 '25 08:09 Michal-Martinek

Some Python packages have different distribution name from package name, for example 'PyGithub' but import github.

But nowadays requests isn't one of them. The requests documentation recommends the following installation command:

python -m pip install requests

And it works.

jnareb avatar Jan 02 '26 10:01 jnareb