pythongitpip

Specify extras_require with pip install -e


How can one manage to install extras_requires with pip when installing from a git repository ?

I know that you can do pip install project[extra] when the project is on pypi.
And you have to do pip install -e git+https://github.com/user/project.git#egg=project for a git repo but I didn't manage to find how to link these two options together.


Solution

  • This should work, per examples #6 and #7

    For remote repos:

    pip install -e git+https://github.com/user/project.git#egg=project[extra]
    

    And this for local ones (thanks to @Kurt-Bourbaki):

    pip install -e .[extra]
    

    As per @Kurt-Bourbaki:

    If you are using zsh you need to escape square brackets or use quotes:

    pip install -e .\[extra\]
    # or
    pip install -e ".[extra]"
    

    As per @Epoc:

    Windows Powershell will also require quoting the brackets.