Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 ?

like image 851
Astariul Avatar asked Oct 23 '25 04:10

Astariul


2 Answers

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.

like image 181
9769953 Avatar answered Oct 25 '25 18:10

9769953


This works:

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

Added #egg=mkdocs.

like image 39
phd Avatar answered Oct 25 '25 17:10

phd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!