Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip 6.0 broke "pip install --pre --upgrade --find-links" #2256

Closed
rgommers opened this issue Dec 22, 2014 · 23 comments
Closed

pip 6.0 broke "pip install --pre --upgrade --find-links" #2256

rgommers opened this issue Dec 22, 2014 · 23 comments
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@rgommers
Copy link

TravisCI for numpy started failing after the pip 6.0 release: numpy/numpy#5386

The reason is that pip install --pre --upgrade --find-links dist numpy, where dist contains a wheel built from current master, starts to install numpy 1.9.1 from PyPi instead of that wheel. I have replicated the issue locally in a virtualenv:

$ pip install --pre --upgrade --find-links ../../numpy/dist numpy  # works with 1.5.6
$ pip uninstall numpy
$ pip install --upgrade pip   # installed pip 6.0
$ pip install --pre --upgrade --find-links ../../numpy/dist numpy  # starts downloading from PyPi

I can bisect the issue in pip if needed, but I'm hoping someone can tell me straight away what changed.

@dstufft
Copy link
Member

dstufft commented Dec 22, 2014

Can you post the final pip install with a -vvv added?

@rgommers
Copy link
Author

Sure:

$ pip install -vvv --pre --upgrade --find-links ../../numpy/dist numpy
Collecting numpy
  Getting page https://pypi.python.org/simple/numpy/
  Starting new HTTPS connection (1): pypi.python.org
  "GET /simple/numpy/ HTTP/1.1" 200 2596
  URLs to search for versions for numpy:
  * https://pypi.python.org/simple/numpy/
  Skipping link ../../numpy/dist (from -f); not a file
  Getting page https://pypi.python.org/simple/numpy/
  Analyzing links from page https://pypi.python.org/simple/numpy/

Didn't know about -vvv, looks useful. The "skipping link" is telling. I don't understand why the message is not a file, according to the docs it can be a path.

@dstufft
Copy link
Member

dstufft commented Dec 22, 2014

Does it work if you use file:///full/path/to/numpy/dist instead?

@rgommers
Copy link
Author

No, same message.

And just for completeness:

$ ls ../../numpy/dist
numpy-1.10.0.dev_243ab56-cp27-none-linux_i686.whl

@dstufft
Copy link
Member

dstufft commented Dec 22, 2014

Hmm. That is very strange. I can't think of what would have changed between then and now. Let me see if I can reproduce locally.

@dstufft
Copy link
Member

dstufft commented Dec 22, 2014

Oh!

I did just notice something. What happens if you change numpy-1.10.0.dev_243ab56-cp27-none-linux_i686.whl to numpy-1.10.0.dev+243ab56-cp27-none-linux_i686.whl.

@rgommers
Copy link
Author

No change when changing _ to +. I hope a plus is not recommended in a versioning scheme now?

Edit: I see your suggestion also had no none. I copied the filename exactly now, still no change

@dstufft
Copy link
Member

dstufft commented Dec 22, 2014

A + has a specific meaning in version schemes now (PEP 440 local versions).

Trying to repro this now.

@dstufft
Copy link
Member

dstufft commented Dec 22, 2014

Hmm. I get this:

Collecting numpy
  URLs to search for versions for numpy:
  Skipping link ./dist (from -f); not a file
  Skipping file:///Users/dstufft/.virtualenvs/tmp-f87184b6fa6f379/dist/numpy-1.10.0.dev_243ab56-cp27-none-linux_i686.whl because it is not compatible with this Python

Wonder if this might be something specific to Linux.

@rgommers
Copy link
Author

OK clear. I'm signing off for tonight. Thanks for looking into this.

@argriffing
Copy link

Looks superficially similar to #1029.

@dstufft
Copy link
Member

dstufft commented Dec 22, 2014

I was able to reproduce the error, but changing the dev-<stuff> to dev+<stuff> fixed it. I believe this error is caused because the version isn't a valid PEP 440 version when you include the githash inside the version like that.

@argriffing
Copy link

With the new pip release, I think the latest development versions of numpy and scipy are considered older than any released version, whereas with the earlier pip version I think this was not the case. Numpy and scipy do not have valid PEP 440 version names.

"""
Check the relative ordering of package versions.

"""
from __future__ import print_function, division

import sys

import numpy
import scipy

import pip
import pkg_resources
import setuptools

def main():
    print('python version:', sys.version)
    print('numpy version:', numpy.__version__)
    print('scipy version:', scipy.__version__)
    print('pip version:', pip.__version__)
    print('setuptools version:', setuptools.__version__)
    print()

    version_names = ('1.14.2', '1.16.2', '1.17.0.dev-deadbeef')

    # I think this is the setuptools order.
    print('version order provided by setuptools pkg_resources:')
    version_objects = [
            pkg_resources.parse_version(x) for x in version_names]
    print(sorted(version_objects))
    print()

    # This should be the pip order.
    print('version order provided by the "vendored" setuptools pkg_resources '
            'provided by pip:')
    try:
        version_objects = [
                pip._vendor.packaging.version.parse(x) for x in version_names]
    except AttributeError:
        version_objects = [
                pip._vendor.pkg_resources.parse_version(x) for x in version_names]
    print(sorted(version_objects))
    print()

main()

1.5.6 output:

python version: 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2]
numpy version: 1.10.0.dev-243ab56
scipy version: 0.16.0.dev-619698b
pip version: 1.5.6
setuptools version: 8.2.1

version order provided by setuptools pkg_resources:
[<LegacyVersion('1.17.0.dev-deadbeef')>, <Version('1.14.2')>, <Version('1.16.2')>]

version order provided by the "vendored" setuptools pkg_resources provided by pip:
[('00000001', '00000014', '00000002', '*final'), ('00000001', '00000016', '00000002', '*final'), ('00000001', '00000017', '*@', '*deadbeef', '*final')]

6.0 output:

python version: 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2]
numpy version: 1.10.0.dev-243ab56
scipy version: 0.16.0.dev-619698b
pip version: 6.0
setuptools version: 8.2.1

version order provided by setuptools pkg_resources:
[<LegacyVersion('1.17.0.dev-deadbeef')>, <Version('1.14.2')>, <Version('1.16.2')>]

version order provided by the "vendored" setuptools pkg_resources provided by pip:
[<LegacyVersion('1.17.0.dev-deadbeef')>, <Version('1.14.2')>, <Version('1.16.2')>]

@argriffing
Copy link

... and when I change the version names to

version_names = (
            '1.14.2',
            '1.16.2',
            '1.17.0.dev-deadbeef',
            '1.17.0.dev+deadbeef',
            )

I get the order [<LegacyVersion('1.17.0.dev-deadbeef')>, <Version('1.14.2')>, <Version('1.16.2')>, <Version('1.17.0.dev0+deadbeef')>]. So I'm almost certain this is the problem.

@rgommers
Copy link
Author

Still doesn't fix it for me. It looks like version ordering is part of the problem, but there's something else. @dstufft question: according to pip install help the --pre option does this:

Include pre-release and development versions. By default, pip only
finds stable versions.

that implies that it does not include local versions. Is that intended, or is the doc wrong? If intended, how do I force install of local versions from a given path?

@rgommers
Copy link
Author

Note to self for easier debugging, also use --no-index (it will fail instead of picking up wrong version from PyPi):

$ pip install -vvv --pre --upgrade --find-links --no-index /home/rgommers/Code/numpy/dist/ numpy
Directory '/home/rgommers/Code/numpy/dist/' is not installable. File 'setup.py' not found.
Exception information:
...

Note that the error message is incomplete, doesn't mention wheels.

@dstufft
Copy link
Member

dstufft commented Dec 23, 2014

PEP 440 local versions count as stable versions unless they are included as part of a pre-release version.

I wonder, does it work if you upgrade setuptools first? I wonder if the difference is I'm running a new setuptools.

@dstufft
Copy link
Member

dstufft commented Dec 23, 2014

Well your latest command fails because it's doing --find-links=--no-index and then telling it to install /home/rgommers/Code/numpy/dist/. You want:

$ pip install -vvv --pre --upgrade --no-index --find-links /home/rgommers/Code/numpy/dist/ numpy

@rgommers
Copy link
Author

@dstufft indeed after upgrading setuptools (version setuptools-8.2.1-py2.py3-none-any.whl) the old version number is not recognized but the PEP 440 one is.

@rgommers
Copy link
Author

I see you already updated the release notes for this backwards compat break, so I guess nothing more to do here. Closing. Thanks for the help in figuring this out!

@dstufft
Copy link
Member

dstufft commented Dec 23, 2014

Note: That we're considering PEP 440 as a sort of provisional thing, so we're not opposed to making changes if it makes sense in a broader ecosystem sense. But if you're able to get things working with how it is now that's good too.

@rgommers
Copy link
Author

Good to know. As far as build/install toolchain issues go, this one is fairly benign. It's a one-character fix plus telling people who run into it to upgrade setuptools - should be no problem.

@argriffing
Copy link

It seems that something changed in pip or setuptools that has required another change in the numpy/scipy version names
numpy/numpy#5556
scipy/scipy#4512

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

No branches or pull requests

3 participants