Jupyter Notebooks

python2 -m pip

Local path

! python2 -m pip install --user --upgrade git+file:///path/to/the/package/.git#egg=package_name

Use the exclamation mark for bash mode, then select the interpreter used by the Kernel (in this case python2) and the git+file:// and #egg=package_name, but with no quotation marks.

requirements.txt

! ipython -m pip -- install --user --upgrade -r requirements.txt

If you are using ipython to install packages via pip instead of python you need to add the -- to seperate the module loading (-m pip) and the call of a ipython-script (here none) from the arguments of ipython.

The requirements file itself also can have have repositories as dependencies.

git+https://github.com/dsavoiu/kafe.git#egg=kafe

for example is the dependency in a requirements.txt. Or with a -e before it to have the latest version always. Or with a @tag_name_or_sha1-hash between the git and the #egg= to explicitly have one specific version (referenced either by the hash of the commit repository or its tag).

Normal Python

Use

python -m pip install git+ssh://git@

Troubleshooting

Command "git clone -q ssh://git@reposerver:user/repo.git /tmp/foo/repo.git" failed with error code 128 in None

You have either not a proper SSH key uploaded or (in this case) you have forgotten to add a slash between the user name and the collon in the URL.

requirements.txt with requirements specifiers

If you use requirements specifier like

six ; python_version < '3.0'

be aware of the impossibility of using them together with the -e mode of VCS.

Since I'm not sure if it is a feature or a bug, I have not filed a bug, yet.