Adam Johnson

Home | Blog | Projects

'pip install' From a Git Repository


Cat with ball

It’s quite common to want to pip install a version of a package that hasn’t been released to PyPI, but is available on its Git repository host, such as GitHub. If the package is pure Python or has a relatively simple build process integrated with, it can be installed from source.

Installing via Git

Pip can speak git to do this through its VCS Support. For example, to install Django’s most recent commit at time of writing, we can run:

pip install git+

Installing via tarballs

An alternative that avoids Git is to install from a tarball URL, that the major hosted Git solutions provide, for example:

# GitHub
pip install
# GitLab
pip install
# Bitbucket
pip install

Either format is slower than using a package on PyPI, because the download will be executed every time the install is run, which you might do with pip install -r requirements.txt on every build. However the tarball formats save a lot of downloading because only the tip of the repository will be downloaded, and not the full history, which can be very big for something like Django!

Also if you need a package with extra requirements, for example django[argon2] which ensures Django gets all the requirements it needs for password hashing, add the #egg argument on the end of the URL. For example:

# Git repo
pip install git+[argon2]
# Tarball
pip install[argon2]


For comparison, on a 100MB/s internet connection, I find the git clone for Django takes 36s whilst the tarball install takes 15s - less than half the time. Installing from PyPI, where a wheel is available, takes just 5s.

The ideal situation is thus to install from PyPI. If an upstream package hasn’t released in a while, it’s worth asking them to, or offering to help with maintenance. Otherwise it is also possible to fork it and publish it on PyPI with a namespace prefix, for example publish your django fork as acme-corp-django.

More info

There’s a lot more options for sources in the pip install docs, but installing from tarball URL’s is the most common piece of advice I find myself giving.

Hope that helps,


Tags: python

Subscribe to my weekly digest email