Note to self: Always version-lock your dependencies!


I was setting up a development copy of a client website on my computer the other day, and after I had cloned the repo, set up the database, and pip installed Django and all of the other python packages needed for the website, I faced a strange Exception coming from deep inside of one of my dependencies. After an embarrasingly long period of troubleshooting, I realized that when I specified my python dependencies, I neglected to include the version requirements for each package.


When I reinstalled my dependencies, I received different versions of some packages, and I received esoteric and perplexing error messages because the dependencies were expected a different schema of the database than what was actually on disk. I’m not even going to include the error message here because it’s very unlikely that anyone else would end up in this same situation. The lesson here is that I should have specified the version for each dependency.

How do you version-lock your dependencies?

First of all, I hope you’re using pip! Then, it’s easy, see the official pip documentation. Basically, just list your dependencies like this:



If you want to save some time, ‘pip freeze’ will list the currently installed version of all packages, so you can compare the output with your existing requirements.txt file.


Much has been said about what separates a jr. developer from a sr. developer (example). I haven’t put in my 10,000 hours yet, but this is definitely a lesson I learned on my way. :)