Configuring so that pip install can work from github Configuring so that pip install can work from github python python

Configuring so that pip install can work from github


You need the whole python package, with a setup.py file in it.

A package named foo would be:

foo # the installable package├── foo│   ├── __init__.py│   └── bar.py└── setup.py

And install from github like:

$ pip install git+ssh://git@github.com/myuser/foo.gitor$ pip install git+https://github.com/myuser/foo.git@v123or$ pip install git+https://github.com/myuser/foo.git@newbranch

More info at https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support


I had similar issue when I had to install from github repo, but did not want to install git , etc.

The simple way to do it is using zip archive of the package. Add /zipball/master to the repo URL:

    $ pip install https://github.com/hmarr/django-debug-toolbar-mongo/zipball/masterDownloading/unpacking https://github.com/hmarr/django-debug-toolbar-mongo/zipball/master  Downloading master  Running setup.py egg_info for package from https://github.com/hmarr/django-debug-toolbar-mongo/zipball/masterInstalling collected packages: django-debug-toolbar-mongo  Running setup.py install for django-debug-toolbar-mongoSuccessfully installed django-debug-toolbar-mongoCleaning up...

This way you will make pip work with github source repositories.


If you want to use requirements.txt file, you will need git and something like the entry below to anonymously fetch the master branch in your requirements.txt.

For regular install:

git+git://github.com/celery/django-celery.git

For "editable" install:

-e git://github.com/celery/django-celery.git#egg=django-celery

Editable mode downloads the project's source code into ./src in the current directory. It allows pip freeze to output the correct github location of the package.


matomo