Search code examples
pythonpycharm

is there any automated way to extract the "pip install"ed dependecies from PyCharm project?


I installed a bunch of dependencies in PyCharm terminal using pip install.

The project works.

Now I want to take all those dependencies and put in requirements.txt file. However, I do not remember what I installed. It's been a while. I can manually recreate the list of installed packages by trial and error. However, is there any automated way to extract the "pip install"ed dependecies from PyCharm project?


Solution

  • Pipreqs creates a requirements.txt with only used libraries in the specified project.

    From the docs;

    Why not pip freeze?

    • pip freeze only saves the packages that are installed with pip install in your environment.
    • pip freeze saves all packages in the environment including those that you don’t use in your current project (if you don’t have
      virtualenv).
    • and sometimes you just need to create requirements.txt for a new project without installing modules.