How can I make setuptools install a package that’s not on PyPI?

Each Answer to this Q is separated by one/two green lines.

I’ve just started working with setuptools and virtualenv. My package requires the latest python-gearman that is only available from GitHub. The python-gearman version that’s on PyPI is an old one. The Github source is setuptools-compatible, i.e. has, etc. Is there a way to make setuptools download and install the new version instead of looking for it on PyPI and installing the old one?

FYI, the new python-gearman is

The key is to tell easy_install where the package can be downloaded. In this particular case, it can be found at the url However, that link by itself won’t work, because easy_install can’t tell just by looking at the URL what it’s going to get.

By changing it to instead, easy_install will be able to identify the package name and its version.

The final step is to add the URL to your package’s dependency_links, e.g.:

   dependency_links = ['']

Now, when YOUR package is being installed, easy_install will discover that there is a “gearman 2.0.0beta” available for download from that URL, and happily pick it over the one on PyPI, if you specify “gearman>=2.0.0beta” in your dependencies..

(Normally, the way this sort of thing is done is to include a link on one’s PyPI page to the downloadable source; in this case, if the author of the gearman package had included a link like the above, you’d be already set. Typically, people mark the development version with ‘myproject-dev’ and then people use a requirement of ‘myproject>=somever,==dev’, so that if there isn’t a package of somever or higher, easy_install will try to check out or download the release.)

You’ll need to specify --process-dependency-links when using pip. Note that dependency links processing has been deprecated and will be removed in a future release.

You can use the pip install protocol+location[@tag][#egg=Dependency] format to install directly from source using pip.


pip install git+
pip install git+[email protected]
pip install git+[email protected]#egg=ProjectName


pip install hg+


pip install svn+svn://


pip install bzr+

The following protocols are supported: [+git, +svn, +hg, +bzr]


@tag lets you specify a specific version/tag to check out.

#egg=name lets you specify what the project is as a dependency for others.

The order must always be @tag#egg=name.

Private Repositories

You can also install from private repositories by changing the protocol to SSH (ssh://) and adding an appropriate user ([email protected]):

git+ssh://[email protected]/username/my_private_repo

You can also install from private repositories with a username / password.


Github provides the ability to create personal OAuth tokens which can be cycled

git+https://<oauth token>:[email protected]/<user>/<repo>.git


requirements.txt is used to specify project dependencies:



These are not installed automatically with the package and must be installed with the command pip -r requirements.txt.

Including requirements files

Requirements files can include other requirements files:


-r requirements-dev.txt


-r requirements.txt



Requirements files can install dependencies specified in with the following command:

-e . can also install from repositories using the same syntax as above, but using the dependency_links value as mentioned in this answer.


As I just had to do the same thing, I found another way to do this as pip‘s --process-dependency-links are scheduled to be removed in pip 19.0 according to this comment.

pip 18.1 includes the following feature

Allow PEP 508 URL requirements to be used as dependencies.

From the description of PEP 508, the syntax for such URL dependencies looks like:

A minimal URL based lookup:

pip @

So in your it would look like

   install_requires = [
   'python-gearman @'

Notice, the link is an archive file and could also be a specific release or branch of a repository as described in this answer. Also, see that answer for working with other repository hosts.

To the best of my knowledge, the easiest way to update the dependency is by using pip install -I . when installing your package from its directory.

Vanilla setuptools does not support downloading directly from a git repository but you can use one of the Download Source links from that page, like:


The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.