2

I'm using pipreqs for generating requirements.txt. I started using hydra package (see https://hydra.cc/ or hydra-core package on PyPI). So I would like pipreqs to add hydra-core dependency automatically when I run.

But, when I checked output of pipreqs (directly in requirements.txt when running pipreqs --force or from console output with pipreqs --print) there is Hydra==2.5. But it's incorrect package (leading to Hydra which is package with a high performance bloom filter). I would expect to see hydra-core==1.0.6 which is the right version of my hydra (hydra-core to be correct) package.

Is there anything what should I do differently? Or is there any issue with pipreqs?


  • Python 3.8.6
  • pipreqs version: 0.4.10
talz
  • 1,004
  • 9
  • 22
Nerxis
  • 3,452
  • 2
  • 23
  • 39
  • This is a common issue, actually (you can see all of the mixups in their "issues" for pipreqs). Most people seem to manually fix the issue. The solution, even from pipreqs' standpoint is not a simple one. – NationWidePants Apr 09 '21 at 16:01

1 Answers1

4

Unfortunately the Hydra package, first released at 2010 - predated the Hydra Framework, so I was not able to use name hydra as the pypi package name (hence hydra-core). I even reached out to the owner of that project, politely asking if he can let go of that name. I was not surprised when he declined :).

Installing hydra instead of hydra-core is pretty common mistake for people getting started with Hydra.

Looking at that project, they do have a mechanism to help indicate what package to use when seeing an import, which might be helpful. See this PR for example. You may want to open a pull request to add hydra-core to their mapping. Given that hydra-core is much more popular than the other hydra, I think they will be okay with it.

Omry Yadan
  • 31,280
  • 18
  • 64
  • 87
  • Thanks, it seems you are right. First, I created issue there (https://github.com/bndr/pipreqs/issues/244). If the solution with updating mapping in pipreqs will be enough I will create PR later. – Nerxis Apr 12 '21 at 07:44
  • @Nerxis: 1. If this answers your question, please accept. 2. Please follow-up on the issue you opened. :) – Omry Yadan Apr 17 '21 at 07:17
  • Yes, I will follow-up but for some reason I didn't receive any notification, thanks for remainder. Regarding answer, I will accept it when PR is merged and everything is working, don't be afraid :-) – Nerxis Apr 17 '21 at 17:39
  • @Nerxis If this solved your issue I would suggest accepting this answer. You should be able to update the mapping file yourself with the guidance provided in this answer. – NationWidePants Apr 21 '21 at 10:35
  • 1
    FYI: https://github.com/bndr/pipreqs/pull/247 was merged, it will probably take some time to the next release but you can build directly from master atm. Thanks for your help. – Nerxis May 06 '21 at 09:25
  • pipreqs got mysql-connector-python wrong too. I guess it is may due to similar reason. – Qiulang Jun 17 '21 at 06:01