pip install a local git repository

Question:

I can’t find the correct way to install a local directory as a python package using pip.

(venv) C:(...)>pip install . --no-index
Ignoring indexes: http://pypi.python.org/simple/
Unpacking c:usersfsantosdesktopbiskates.combiskatesforksdjango-pipeline
  Running setup.py egg_info for package from file:///(...)%5Cforks%5Cdjango-pipeline

Installing collected packages: django-pipeline
  Running setup.py install for django-pipeline

Successfully installed django-pipeline
Cleaning up...

(venv) C:(...)>cd ..
(venv) C:(...)>python
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pipeline
>>> pipeline.__file__
'C:\(...)site-packages\pipeline\__init__.py'
>>>

As you can see pip just copied over the package to site-packages. How can I avoid this, and use the package directly from its source folder?

I’m trying to integrate django-pipeline into my Django project, but I want to add support for Django 1.4 first, so I forked and cloned my fork.

Asked By: Fábio Santos

||

Answers:

I can also just use:

cd your-local-repo
pip install -e .

or

python setup.py install develop
Answered By: silviomoreto

If you’re working in a venv, you can do this:

env/bin/pip install git+file:///path/to/your/git/repo

Or with a branch:

env/bin/pip install git+file:///path/to/your/git/repo@mybranch
Answered By: Quilt

You can use pip or pipenv with the following command to install from a local git repo:

pip install git+file:///path/to/your/package#egg=package-name

Note that there are 3 slashes after file: here.

To install from a remote repo use:

pip install git+ssh://[email protected]:Username/Project.git

You can also specify a desired branch like so:

pip install git+ssh://[email protected]:Username/Project.git@master

I just rounded up the previous answers and comments from Quilt and nanounanue and this question. Also posted it here.

Answered By: Danil
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.