Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip install a local git repository

Tags:

git

python

pip

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:\users\fsantos\desktop\biskates.com\biskates\forks\django-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.

like image 598
Fábio Santos Avatar asked Jan 04 '13 14:01

Fábio Santos


People also ask

Can you pip install a Git repo?

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.

Can you pip install a local package?

Install the downloaded package into a local directory : python get-pip.py --user This will install pip to your local directory (. local/bin) . Now you may navigate to this directory (cd . local/bin) and then use pip or better set your $PATH variable this directory to use pip anywhere : PATH=$PATH:~/.

Does pip install locally or globally?

The Pip Package Manager can be used to list both globally and locally installed Python packages.


2 Answers

I can also just use:

cd your-local-repo pip install -e . 

or

python setup.py install develop 
like image 159
silviomoreto Avatar answered Oct 01 '22 08:10

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 
like image 39
Quilt Avatar answered Oct 01 '22 10:10

Quilt