pip install from git repo branch
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Quiet Intelligence
--
Chapters
00:00 Question
00:38 Accepted answer (Score 1355)
00:58 Answer 2 (Score 415)
02:22 Answer 3 (Score 155)
02:47 Answer 4 (Score 57)
03:08 Thank you
--
Full question
https://stackoverflow.com/questions/2010...
Accepted answer links:
[VCS Support]: https://pip.pypa.io/en/stable/topics/vcs.../
Answer 2 links:
https://github.com/django/django@stable/...
Answer 3 links:
https://pip.pypa.io/en/stable/topics/vcs.../
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #git #pip
#avk47
ACCEPTED ANSWER
Score 1576
Prepend the url prefix git+ (See VCS Support):
pip install git+https://github.com/tangentlabs/django-oscar-paypal.git@issue/34/oscar-0.6
And specify the branch name without the leading /.
ANSWER 2
Score 458
Using pip with git+ to clone a repository can be extremely slow (test with https://github.com/django/django@stable/1.6.x for example, it will take a few minutes). The fastest thing I've found, which works with GitHub and BitBucket, is:
pip install https://github.com/user/repository/archive/branch.zip
which becomes for Django master:
pip install https://github.com/django/django/archive/master.zip
for Django stable/1.7.x:
pip install https://github.com/django/django/archive/stable/1.7.x.zip
With BitBucket it's about the same predictable pattern:
pip install https://bitbucket.org/izi/django-admin-tools/get/default.zip
Here, the master branch is generally named default.
This will make your requirements.txt installing much faster.
Some other answers mention variations required when placing the package to be installed into your requirements.txt. Note that with this archive syntax, the leading -e and trailing #egg=blah-blah are not required, and you can just simply paste the URL, so your requirements.txt looks like:
https://github.com/user/repository/archive/branch.zip
ANSWER 3
Score 192
Instructions to install from private repo using ssh credentials:
$ pip install git+ssh://git@github.com/myuser/foo.git@my_version
To install a package from a subdirectory, say stackoverflow
$ pip install git+ssh://git@github.com/myuser/foo.git@my_version#subdirectory=stackoverflow
ANSWER 4
Score 60
Just to add an extra, if you want to install it in your pip file it can be added like this:
-e git+https://github.com/tangentlabs/django-oscar-paypal.git@issue/34/oscar-0.6#egg=django-oscar-paypal
It will be saved as an egg though.