How to use `pip` and setup.py to automatically install dependencies that may be private repositories hosted on github
<p>I don't think this is a dupicate, because I tried all links I could find for the past 2 hours and none of the solutions worked. I want the user to be able to clone a repository, <code>cd</code> into the directory, and run <code>$ pip install .</code> (or at least <code>pip install --process-dependency-links .</code>)  to install the package, its pypi dependencies <strong>AND</strong> its (latest) <strong>private</strong> github dependencies assuming the user has read permissions for them. (also the devs should be able to run <code>$ pip install -e .</code>)</p>

<p>my <code>setup.py</code>:</p>

<pre><code>setup (
    ...
    install_requires=['
        ...
        private-pkg
        ...
    ],
    dependency_links=[
        'git+ssh://git@github.com/private-org/private-pkg.git@master#egg=private-pkg'],
    )
</code></pre>

<p>I also tried different variations for dependency_links:</p>

<ul>
<li><code>https://github.com/private-org/private-pkg/tarball/master#egg=private-pkg</code></li>
<li><code>git+https://git@github.com/private-org/private-pkg.git@master#egg=private-pkg</code></li>
</ul>

<p>I also tried adding a trailing <code>-1.0.0</code> (for version) and it doesn't work but in any case, I'd like the user to be able to install the lastest version</p>

<p>Note that I can do:</p>

<p><code>pip install "git+https://github.com/private-org/private-pkg"</code> and it works fine, but I can't get <code>pip install .</code> to work no matter what.</p>

<p>All these fail with the same error:</p>

<p><code>Could not find a version that satisfies the requirement private-pkg (from my-pkg==1.0.0) (form versions: ) No matching distribution found for private-pkg (from my-pkg==1.0.0)</code></p>

<p>Running it with <code>pip install -vvv .</code> shows that <code>pip</code> never looks for the git link, but running it with <code>pip install --process-dependency-links -vvv .</code> tries to fetch it but fails for various reasons ("Cannot look at git URL", or "Could not fetch URL"). Note that <code>--process-dependency-links</code> is marked as deprecated.</p>

<p>pip expects to have a link to index page (such as PyPI) in <code>dependency_links</code>. Any link to VCS is going to be skipped. This behavior was changed in commit <a href="https://github.com/pypa/pip/commit/26facddaa81be3447b8e06a9886c03b90fd68309" rel="nofollow">26facdd</a>.</p>

<p>I recommend to define all external dependencies in <code>requirements.txt</code> file and then run <code>pip install -r requirements.txt</code>. Example of requirements.txt:</p>

<pre><code>foo&gt;=1.0
-e git+ssh://git@github.com/private-org/private-pkg.git@master#egg=private-pkg
</code></pre>

<p>See also <a href="http://stackoverflow.com/questions/16584552/how-to-state-in-requirements-txt-a-direct-github-source">How to state in requirements.txt a direct github source</a></p>

<p>There is an article about <a href="https://caremad.io/posts/2013/07/setup-vs-requirement/#a-setuptools-misfeature" rel="nofollow">setup.py vs requirements.txt</a>, which describes this misfeature.</p>

python pip setuptools packaging setup.py