Predictive Hacks

How to Generate Requirements.txt For Your Python Project Without Environments

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.

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

Python

Image Captioning with HuggingFace

Image captioning with AI is a fascinating application of artificial intelligence (AI) that involves generating textual descriptions for images automatically.

Python

Intro to Chatbots with HuggingFace

In this tutorial, we will show you how to use the Transformers library from HuggingFace to build chatbot pipelines. Let’s