When I’m working on a new python project I just want to open the jupyter notebook in a new folder and start working. After the project is done, sometimes we have to create a requirements.txt file that contains all the libraries we used in the project so we can share it or deploy it on a server.
This is so annoying because we have to create an environment and then re-install the libraries we used so we can generate the requirements file for this project.
Fortunately, there is a package called PIGAR that can generate the requirements file for your project automatically without any new environments.
Installation
pip install pigar
Let’s use it for a project. You can clone the dominant color repo and delete its requirements file. Then, open your terminal, head over the projects folder, and run the following:
pigar
Simple as that. You should see that a new requirements.txt file is generated with the libraries used for the project.