Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install a Python project from the subdirectory of a git repository with pip?

Tags:

git

pip

I am trying to install Deribit (a crypto-currency exchange) Python client (in my Amazon Sagemaker Notebook).

The project can be found in the python subdirectory of a git repository at the following location:

  • https://github.com/deribit/deribit-api-clients/tree/master/python

How can I install this project from this location with pip?

like image 796
Dan Avatar asked Oct 24 '25 10:10

Dan


1 Answers

As noted in the "VCS Support" chapter of pip's documentation, the correct notations are the following:

  • python -m pip install 'openapi-client @ git+https://github.com/deribit/deribit-api-clients.git#subdirectory=python'

  • python -m pip install 'git+https://github.com/deribit/deribit-api-clients.git#egg=openapi-client&subdirectory=python'

The first one being the modern notation, and the second one being a rather outdated notation.

Notes:

  • use the git+https scheme
  • specify the subdirectory where the project can be found inside the git repository subdirectory=path/to/project
  • specify the name of the actual Python project:
    • either in the form ProjectName @ vcs+protocol://..., which is the modern notation
    • or as a fragment egg=ProjectName of the VCS URI, which is the outdated notation
like image 94
sinoroc Avatar answered Oct 26 '25 03:10

sinoroc



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!