Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python / pip, how do I install a specific version of a git repository from github (what is the correct url)?

Tags:

I want to install Django 1.7 via pip. It is currently a development version, so not in pips repositories.

So I have installed packages from github before using:

pip install git+[url here] 

Now looking at github, I get the clone url on the django page:

https://github.com/django/django.git 

But this mentions nothing of the branch. How do I specify that I want version 1.7? Is it somewhere obvious on the github page?

like image 857
wobbily_col Avatar asked May 07 '14 14:05

wobbily_col


People also ask

How do you pip install a specific version of a library?

How do I Install a Specific Version of a Python Package? To install a specific version of a Python package you can use pip: pip install YourPackage==YourVersion . For example, if you want to install an older version of Pandas you can do as follows: pip install pandas==1.1. 3 .

Can you pip install from github?

You can deploy Git locally, or use it via a hosted service, such as Github, Gitlab or Bitbucket. One of the advantages of using pip together with Git is to install the latest commits of unreleased Python packages as branches from Github.


1 Answers

Specify the branch, commit hash, or tag name after an @ at the end of the url:

pip install git+https://github.com/django/[email protected] 

This will install the version tagged with 1.7b3.

Reference: https://pip.pypa.io/en/latest/reference/pip_install.html#git

like image 190
ford Avatar answered Oct 28 '22 15:10

ford