Installing Python Dependancies Using requirements.txt

May 12, 2022

I come from PHP land where you can use PHP Composer to install dependencies automatically. Glad to figure out how to use Python's version with the requirements.txt. I wish that tutorials would put this at the beginning.

Find your dependency versions using 'pip freeze' for your requirements.txt

pip3 freeze

then, I copied out all the dependancies that I had installed myself and put them in my requirements.txt file at the base of your project (like the composer.json). Here is a sample of my requirements.txt

Django==4.0.4
django-browser-reload==1.3.0
django-light==0.1.0.post3
django-taggit==2.1.0
django-tailwind==3.1.1
mysqlclient==2.1.0
Pillow==9.1.0
django-environ==0.8.1

Install all your dependencies on a fresh clone using pip

pip3 install -r requirements.txt

Make sure you have setup your .env

I store my .env-sample file in my /mysite directory. So, next I need to copy that file and then put in the environment variable settings. Then I am ready to run the local server.

Book Reviews

I am nuts about books. I read on all kinds of topics. I attempt to review each book I read for the sake of my own enrichment as well as conversation starters with others.

My Book Reviews
The Attic

You never know what you will find in an attic! Usually there is a hodgepodge of things buried under dust.

Explore the Attic
Technology

Most of what is included here are notes to myself. The majority of folks will not find interest in these posts.

Technology Posts