bndr / pipreqs

pipreqs - Generate pip requirements.txt file based on imports of any project. Looking for maintainers to move this project forward.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

commented

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.

  1. 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.
  2. The get_all_imports function assumes that we only want the top-level module. They give the example django.conf should only import django. This assumption is broken for several of the azure modules, eg azure.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.