
Image 8 - Saving requirements.txt to a different location (image by author)Īnd that’s pretty much all you can do with Pipreqs. Here’s how I saved the file to the Desktop: There’s a better way, and today you’ll learn all about it.ĭon’t feel like reading? Well, you don’t have to: A requirements.txt file generated with pip freeze will include both used and unused libraries, which is just a waste of resources. During the project, you decide not to use some libraries, but you forget to delete them from the environment. Picture this - you create a new virtual environment and install a bunch of dependencies. It does the same thing as pip freeze, but better. This is traditionally done via the pip freeze command, which outputs all libraries installed in a virtual environment.īut what if you want only the ones used in the project? That’s where pipreqs comes into play.

It stores the information of all libraries needed for a project to run, and is essential when deploying Python projects. Want to include only the libraries you use in requirements.txt? Try pipreqs, a Python module for creating leaner requirements files.Įvery Python project should have a requirements.txt file.
