Search code examples
pythonpippackage

How to add git source in requirements.txt


I would like to install a certain package from a private git repository. This is possible using pip install git+<REPO_LINK>. However, I would like to pip install -r requirements.txt all of my packages at the same time without having to specify which one comes from Pypi and private repo.

I have tried adding a configuration in ~/.config/pip/pip.conf

[global]
find-links =
    git+<REPO_LINK>

but this happened when running pip install -r requirements.txt:

ERROR: Could not find a version that satisfies the requirement my-package==0.1

Thanks in advance.


Solution

  • I have found a solution for it at this doc.

    pip install git+<REPO_LINK>#egg=<PACKAGE_NAME>

    When I run pip freeze, the package I have just installed is printed like this:

    git+<REPO_LINK>#egg=<PACKAGE_NAME>

    Add it to your requirements.txt so pip install -r requirements.txt install this specific package so as public ones from Pypi.

    :)