Install pygit2 on Ubuntu 16.04 (Xenial Xerus)

On a fresh install of Ubuntu 16.04, this will get you pygit2.

sudo apt-get install python-dev libffi-dev libssl-dev libxml2-dev libxslt1-dev libssh2-1 libgit2-dev python-pip libgit2-24 -y  
sudo pip install pygit2  

This should output:

Successfully built pygit2
Installing collected packages: pygit2
Successfully installed pygit2-0.24.0

Test it:

sudo python -c 'import pygit2'  

If it prints nothing, you're good to go.