4

I am aware that pip freeze > requirements.txt exists, yet that that prints out my system packages, of which only a few my directory/ project needs.

I am not using a virtualenv so I'm pretty sure I can't print out local packages like that.

I also know that pipdeptree exsists but I also don't see how that solves my problem?

sinoroc
  • 18,409
  • 2
  • 39
  • 70
Carlos Medina
  • 380
  • 2
  • 15
  • `pip freeze > requirements.txt` generates a single list of the specific packages used by your current Python interpreter (which can be a venv + base interpreter) on which pip is installed. While if you use `setup.py` the `install-requires` can list the minimum requirements. Basically your question is how to generate requirements minimum dependencies of the project and not from the current interpreter/venv. I don't know if that is possible using pip. See [this question](https://stackoverflow.com/questions/6947988) and [this one](https://stackoverflow.com/questions/14399534). – bad_coder Aug 13 '20 at 23:58

1 Answers1

5

I believe tools like the following could help:

As far as I can tell, these tools read the code in the directory and try to figure out the dependencies required based on the import statements they found in the code.

Related:

sinoroc
  • 18,409
  • 2
  • 39
  • 70