Pip Install From a Git Repository

Ahmet DAL
2 min readDec 27, 2019

--

Pip is a package manager of python. You can download Python libraries from some Python repositories like PyPI. You can also download libraries from a git repository. This is gonna be the issue to be explained in this article.

I don’t like to memorize things all the time. So, I guess, I couldn’t be working without internet :). Whenever I need to install some python libraries from a git repository, I see a lot of ways to do it. It is really confusing. This should be the reason why I can’t memorize it. I can see how a very simple requirement is handled in many confusing ways. There shouldn’t be too many ways. Some of them is not working either. At last, I decided to blog it.

As you may know, you can use two protocols which are http and ssh to do something on git repositories. Using protocol SSH instead of http may provide some ease of use. Because of nature of SSH, you can do something with your primary/public keys. So, you don't have to input your credentials all the time. But I'll be giving a try for both;

Here are the examples with bitbucket git repositories;

pip install git+https://bitbucket.org/<project_owner>/<project_name> #Example: pip install git+https://bitbucket.org/egemsoft/esefpy-webpip install git+ssh://git@bitbucket.org/<project_owner>/<project_name>.git/ 
#Example: pip install git+ssh://git@bitbucket.org/egemsoft/esefpy-web.git
#For Local Git Repository
pip install git+file///path/to/your/git/project/
#Example: pip install git+file:///Users/ahmetdal/workspace/celery/

--

--

Ahmet DAL

Software Engineer with Some Data Inisght | Java, Python, Scala, SQL