Home > Blockchain >  How to install extra-requires from a github link with `pip`
How to install extra-requires from a github link with `pip`

Time:10-16

I have this python package located in a github repository. I can install it from the github link directly like so :

pip install git https://github.com/mkdocs/mkdocs.git

I would like to do the same, but install some extra dependencies. When using just the package name, we can do :

pip install mkdocs[i18n]

But if I try :

pip install git https://github.com/mkdocs/mkdocs.git[i18n]

It fails with the following error :

Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com

Collecting git https://github.com/mkdocs/mkdocs.git[i18n]
Cloning https://github.com/mkdocs/mkdocs.git[i18n] to /tmp/pip-req-build-1ykhyonq
Running command git clone -q 'https://github.com/mkdocs/mkdocs.git[i18n]' /tmp/pip-req-build-1ykhyonq
fatal: unable to access 'https://github.com/mkdocs/mkdocs.git[i18n]/': The requested URL returned error: 400

WARNING: Discarding git https://github.com/mkdocs/mkdocs.git[i18n]. Command errored out with exit status 128: git clone -q 'https://github.com/mkdocs/mkdocs.git[i18n]' /tmp/pip-req-build-1ykhyonq Check the logs for full command output.

ERROR: Command errored out with exit status 128: git clone -q 'https://github.com/mkdocs/mkdocs.git[i18n]' /tmp/pip-req-build-1ykhyonq Check the logs for full command output.


How can I use extra-dependencies with github links ?

CodePudding user response:

Following example 7 from https://pip.pypa.io/en/stable/cli/pip_install/#examples :

pip install "mkdocs[i18n] @ git https://github.com/mkdocs/mkdocs.git"

The '@' symbol usage is is explained in detail in PEP 440, in the section direct references.

CodePudding user response:

This works:

pip install "git https://github.com/mkdocs/mkdocs#egg=mkdocs[i18n]"

Added #egg=mkdocs.

  • Related