Skip to content

Setuptools pulls down incompatible version of package with develop #1009

Closed

Description

@jtratner

Context: IPython just released 6.0rc1 on to PyPI, which is only compatible with 3.3+. pip install ipython on python 2.7 pulls down IPython 5.3.0 as you'd expect when invoked as pip install ipython. However, setuptools instead pulls down IPython 6.0 leading to an installation error.

Minimally reproducible example:

# setup.py
from setuptools import setup

setup(
    name='example',
    install_requires=['ipython'],
)

Outputs:

(env) $ python -c 'import pkg_resources; print pkg_resources.get_distribution("setuptools")'
setuptools 34.4.1
(env) $ python setup.py develop
running develop
running egg_info
writing requirements to example.egg-info/requires.txt
writing example.egg-info/PKG-INFO
writing top-level names to example.egg-info/top_level.txt
writing dependency_links to example.egg-info/dependency_links.txt
reading manifest file 'example.egg-info/SOURCES.txt'
writing manifest file 'example.egg-info/SOURCES.txt'
running build_ext
Creating /Users/jtratner/env/lib/python2.7/site-packages/example.egg-link (link to .)
example 0.0.0 is already the active version in easy-install.pth

Installed /Users/jtratner
Processing dependencies for example==0.0.0
Searching for ipython
Reading https://pypi.python.org/simple/ipython/
Downloading https://pypi.python.org/packages/76/46/c505c48d264715136edde1a1960f9158133e34c03bbfe4c955dbc5948ce4/ipython-6.0.0rc1.tar.gz#md5=e57acb5fabd9f18b739de35a1f00eac5
Best match: ipython 6.0.0rc1
Processing ipython-6.0.0rc1.tar.gz
Writing /var/folders/h2/64h07zpd7576xz6wcq8jdzrw0000gp/T/easy_install-BGbWO9/ipython-6.0.0rc1/setup.cfg
Running ipython-6.0.0rc1/setup.py -q bdist_egg --dist-dir /var/folders/h2/64h07zpd7576xz6wcq8jdzrw0000gp/T/easy_install-BGbWO9/ipython-6.0.0rc1/egg-dist-tmp-zb3BA7

IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.
When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
Beginning with IPython 6.0, Python 3.3 and above is required.

See IPython `README.rst` file for more information:

    https://github.com/ipython/ipython/blob/master/README.rst

Python sys.version_info(major=2, minor=7, micro=9, releaselevel='final', serial=0) detected.


error: Setup script exited with 1

and on the same system pip does the "right" thing

(env) $ pip install --no-cache-dir -i https://pypi.python.org/simple ipython
# snip...
Successfully installed appnope-0.1.0 backports.shutil-get-terminal-size-1.0.0 decorator-4.0.11 enum34-1.1.6 ipython-5.3.0 ipython-genutils-0.2.0 pathlib2-2.2.1 pexpect-4.2.1 pickleshare-0.7.4 prompt-toolkit-1.0.14 ptyprocess-0.5.1 pygments-2.2.0 scandir-1.5 simplegeneric-0.8.1 traitlets-4.3.2 wcwidth-0.1.7
(env) $ pip uninstall ipython

I've tested and this happens on OSX and a centos6 box I have access to.

Activity

  1. jtratner commented on Apr 11, 2017

    @jtratner
    Author

    (there's a secondary issue here that I think setuptools should not be pulling down an rc release at all - but possibly 6.0.0rc1 is not a valid release candidate description? I was not clear from reading the PEP)

  2. jaraco commented on Apr 11, 2017

    @jaraco
    Member

    easy_install doesn't exclude pre and post release versions as pip does. You should probably just use pip install -e instead of setup.py develop.

  3. jtratner commented on Apr 11, 2017

    @jtratner
    Author
  4. jaraco commented on Apr 11, 2017

    @jaraco
    Member

    Yes, I think that's expected. Support for packages to declare which Python versions are supported is fairly new. I'm not even aware of any feature in pip to restrict packages based on Python version.

    Indeed:

    vagrant@trusty:~$ python2.7 -m pip install --pre ipython
    Downloading/unpacking ipython
      Downloading ipython-6.0.0rc1.tar.gz (5.1MB): 5.1MB downloaded
      Running setup.py (path:/tmp/pip_build_vagrant/ipython/setup.py) egg_info for package ipython
        
        IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.
        When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
        Beginning with IPython 6.0, Python 3.3 and above is required.
        
        See IPython `README.rst` file for more information:
        
            https://github.com/ipython/ipython/blob/master/README.rst
        
        Python sys.version_info(major=2, minor=7, micro=6, releaselevel='final', serial=0) detected.
        
        
        Complete output from command python setup.py egg_info:
        
    
    IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.
    
    When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
    
    Beginning with IPython 6.0, Python 3.3 and above is required.
    
    
    
    See IPython `README.rst` file for more information:
    
    
    
        https://github.com/ipython/ipython/blob/master/README.rst
    
    
    
    Python sys.version_info(major=2, minor=7, micro=6, releaselevel='final', serial=0) detected.
    
    
    
    
    
    ----------------------------------------
    Cleaning up...
    Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_vagrant/ipython
    Storing debug log for failure in /home/vagrant/.pip/pip.log
    

    The only reason pip doesn't normally install 6.0rc1 by default is because it's a pre-release version. When 6.0 is released, pip will fail to install it also on Python 2.

    Eventually, pip and/or warehouse will probably add support to read the metadata for the package and filter out non-viable versions. I'm not sure which package if any will do that. However, easy_install, being mostly deprecated, will not get support for these new features.

  5. Carreau commented on Apr 11, 2017

    @Carreau
    Contributor

    Support for packages to declare which Python versions are supported is fairly new. I'm not even aware of any feature in pip to restrict packages based on Python version.

    That was covered by pypa/pip#3877 writen in part by me, and explicitly to cover this use case. So it should not be wontfix as it is also one of the main reason to migrate to pip9. We even send PR to PyPI legacy and patch to warehouse to support this.

  6. Carreau commented on Apr 11, 2017

    @Carreau
    Contributor

    Also can you please reopen ?

  7. jaraco commented on Apr 11, 2017

    @jaraco
    Member

    If the issue is addressed in pip, why would we re-open this issue in setuptools?

  8. xavfernandez commented on Apr 11, 2017

    @xavfernandez
    Member

    Eventually, pip and/or warehouse will probably add support to read the metadata for the package and filter out non-viable versions.

    For the record, like @Carreau pointed out, such support was added in pip 9.

    (tmp-f58eb2604fd386e)$ python -V
    Python 3.4.6
    (tmp-f58eb2604fd386e)$ pip install gidgethub
    Collecting gidgethub
      Could not find a version that satisfies the requirement gidgethub (from versions: )
    No matching distribution found for gidgethub
    (tmp-fb86749fd437f6b)$ pip install https://pypi.python.org/packages/cc/64/75d5ad78abd12eb66a4b46eaeeff255fd4b88428c99ee118444c809c6a8c/gidgethub-2.0.0-py3-none-any.whl
    Collecting gidgethub==2.0.0 from https://pypi.python.org/packages/cc/64/75d5ad78abd12eb66a4b46eaeeff255fd4b88428c99ee118444c809c6a8c/gidgethub-2.0.0-py3-none-any.whl
      Using cached gidgethub-2.0.0-py3-none-any.whl
    gidgethub requires Python '>=3.6.0' but the running Python is 3.4.6
    

    (and of course, both works with Python 3.6)

  9. Carreau commented on Apr 11, 2017

    @Carreau
    Contributor

    It seem your pip is out of date, as pip 9.0.1 seem to not behave as in your screenshot.

    MacBook-Pro-4:~ bussonniermatthias$ python2 -m pip --version
    pip 9.0.1 from /usr/local/lib/python2.7/site-packages (python 2.7)
    MacBook-Pro-4:~ bussonniermatthias$ python2 -m pip install ipython --pre --upgrade
    Collecting ipython
      Using cached ipython-5.3.0-py2-none-any.whl
    

    So pip does the right thing.

  10. jaraco commented on Apr 11, 2017

    @jaraco
    Member

    It seem your pip is out of date

    Indeed. I was testing with stock pip on Ubuntu Trusty.

  11. Carreau commented on Apr 11, 2017

    @Carreau
    Contributor

    Indeed. I was testing with stock pip on Ubuntu Trusty.

    I'll add a line in the warning message that warn user that pip may be out of date.

  12. tvalentyn commented on Jul 12, 2019

    @tvalentyn

    I observe the same issue with setuptools-41.0.1 on Windows (but not on Linux). Usecase:
    a project depends on numpy>=1.13.0. On a Windows machine with Python 2.7 and pip==19.1.1, setuptools for test command attempts to pull an incompatible package numpy==1.17.0rc1, which requires Python 3.5. pip install picks up correct version. I assume this issue is still considered WAI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions