Pipreqs adds wrong package to requirements.txt
artemgur opened this issue · comments
In my project, I use kafka-python package.
When pipreqs generates requirements.txt, it adds kafka package in addition to kafka-python package.
kafka package is not used in the project, it's not even installed.
I have the same problem.
I suppose pipreqs doesn't support hyphenated packages yet.
I have similar issue with azure-storage.
It adds azure-storage==0.37, which is deprecated and cannot be installed instead of azure-storage-blob==12.15.0, that is actually installed and used. Is there a workaround for this or should I switch back to pip freeze to create requirements files?
It looks like the same problem as sklearn not correctly formed
It adds azure-storage==0.37, which is deprecated and cannot be installed instead of azure-storage-blob==12.15.0, that is actually installed and used. Is there a workaround for this or should I switch back to pip freeze to create requirements files?
I'm having the same issue with azure related modules. It seems like there are a few assumptions in the package deduction that are getting in the way.
- For azure specifically, there are multiple entries in the mapping with the 'azure' key. Meaning that subsequent entries for 'azure' will overwrite previous entries. Hence, why
azure-storage
is showing up. - The
get_all_imports
function assumes that we only want the top-level module. They give the exampledjango.conf
should only importdjango
. This assumption is broken for several of the azure modules, egazure.functions
actually should point to the azure-functions project.
Currently I don't have a great proposal for how to redesign the mapping between module imports and pypi project names. I think this is a recurring issue that the maintainers have identified. My current thought is there may be a way to programatically generate the mapping file by queries to the pypi package api, though I don't have a working prototype yet.
I had the same problem.
I have a private python module locates in folder lib, then pipreqs added lib into requirement.txt while this lib acctully refers to https://pypi.org/project/lib/ and confused users that install with this txt file.