Python Pip Install From Github

Sharing is caring!

Last Updated on July 14, 2022 by Jay

Python users are familiar with pip install, but do you know that we can actually install a library found on github? The most common usage of pip is to install a library from PyPI (Python Package Index). However, not all great libraries exist on PyPI, some authors might choose to just leave their library on a Github page for example.

What Is Pip

pip is a package management software written in Python. It’s one of the most common ways to install 3rd party Python libraries on your computer. It’s also simple to use, most of the time just takes 2 steps:

  1. Open up a command prompt (or terminal) window
  2. Type “pip install [library_name]”

The above command will download the pandas library from PyPI and install it on our computer. If a library doesn’t exist on PyPI, then we have to do something else.

What Is Github

git is a version control system mainly used for code/text files. It’s like how most people manage Excel files by adding the “_v1”, “_v2”, etc at the end of their files, but 100 times better.

Github is a website that hosts the git software in the cloud so that people from different places can access code from anywhere with internet access. There are other companies provide git and version control hosting, but Github is The Player in the field. According to Wikipedia, 73 million people around the world use Github at the end of 2021. In other words, we can find a lot of cool software, including Python libraries, on Github.

Pip Install Directly From Github

Before you attempt the following, make sure that you have both installed:

  1. Python / pip
  2. git (if you need help with installation, check out the Install Git section at the bottom)

We still use the command prompt/terminal window to install, but the syntax is like this:

pip install git+[user name]/[repo].git@[branch]

Here’s an example of installing a library called bar_chart_race. Note there’s a version of the library on PyPI, if you type “pip install bar_chart_race”, then it’s going to grab the version on PyPI and install that. We are going to install a variant of the library which is found on another Github repository.

See below, we can get the user name, repo name, and the branch name from any given repository URL.

To pip install this specific version of the bar_chart_race directly from Github, we’ll need to type the following command into the terminal window:

pip install git+

If you get an error message like this:

ERROR: Error [WinError 2] The system cannot find the file specified while executing command git version
ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?

It means you probably don’t have git installed. You can follow the below section to install git first. Close and then re-open a new command prompt/terminal window and type pip install git+… again. It should work now!

Additional Resources

pip is not recognized – How to fix it?

Install Git

To install git, head over to the official website: Download and install the latest version that fits your computer’s operating system.

The installation wizard will ask you quite a few questions, I’ll help guide you through:

  1. Select Components – default settings are fine

2. Choosing editor – this is for when you need to edit things for git, for example adding comments. Feel free to choose any editor from the list below. I’m using Visual Studio Code for this option.

3. For the next several windows, I’ll be using the default options.

Leave a Reply

Your email address will not be published. Required fields are marked *