setuptools: dependency_links flag ignored when package exists on PyPI

I am relying on pyswarm for a package I am working on. PyPI’s latest version is 0.6, but I need 0.7, which is only on GitHub. My stripped-down setup function is below:

from setuptools import setup, find_packages

setup(
    name='mypackage',
    version='0.1',
    packages=find_packages(exclude=('examples', 'docs')),
    install_requires=['pyswarm>=0.7'],
    dependency_links=[
        "git+https://github.com/tisimst/pyswarm",
    ]
)

As shown here, the install fails with:

$ pip install mypackage
...
Could not find a version that satisfies the requirement pyswarm>=0.7 (from mypackage==0.1) (from versions: 0.5, 0.6)
No matching distribution found for pyswarm>=0.7 (from mypackage==0.1)

However, installing via pip works perfectly fine, satisfying pyswarm>=0.7:

$ pip install git+https://github.com/tisimst/pyswarm
Collecting git+https://github.com/tisimst/pyswarm
  Cloning https://github.com/tisimst/pyswarm to /tmp/pip-0k6viimo-build
Requirement already satisfied: numpy in /home/sean/opt/anaconda3/lib/python3.5/site-packages (from pyswarm==0.7)
Installing collected packages: pyswarm
  Running setup.py install for pyswarm ... done
Successfully installed pyswarm-0.7

Why is dependency_links being ignored when setup() attempts to find pyswarm-0.7? It appears that versions 0.5 and 0.6 are found on PyPI (and do not satisfy the requirements), but version 0.7 is not found via the GitHub link despite the fact that pip installs from the same link just fine.

My current workaround is to run pip install git+https://github.com/tisimst/pyswarm via subprocess.call() before setup() is called (thus satisfying the pyswarm>=0.7 requirement), but this should not be necessary.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 11
  • Comments: 17 (6 by maintainers)

Most upvoted comments

It’s because your missing a version in your link, since you ask for hbmqtt>0.9.0, either use:

install_requires=[
   'hbmqtt'
],
dependency_links=[
   'git+https://github.com/beerfactory/hbmqtt.git@f4330985115e3ffb3ccbb102230dfd15bb822a72#egg=hbmqtt'
],

or better tag your link version, e.g.:

install_requires=[
    'hbmqtt>0.9.0'
],
dependency_links=[
    'git+https://github.com/beerfactory/hbmqtt.git@f4330985115e3ffb3ccbb102230dfd15bb822a72#egg=hbmqtt-0.9.1.dev'
],

@gijzelaerr, if I can remember, this flag didn’t help me.

Closing, as dependency links support has been dropped in recent versions of pip.

did you try the --process-dependency-link flag?

https://github.com/pypa/pip/issues/4295