pypa / pip

The Python package installer
https://pip.pypa.io/
MIT License
9.5k stars 3.01k forks source link

add more detail on platform missmatch errors instead of just declaring not matching distributions found #5003

Open RonnyPfannschmidt opened 6 years ago

RonnyPfannschmidt commented 6 years ago

pip 9.0.1 python 2

got

$ pip install --user keyring_jeepney
Collecting keyring_jeepney
  Could not find a version that satisfies the requirement keyring_jeepney (from versions: )
No matching distribution found for keyring_jeepney

expected

$ pip install --user keyring_jeepney
Collecting keyring_jeepney
  Could not find a version that is supported on your platform
  # perhaps some more information on the platform mismatch, like os, python version 
No matching distribution found for keyring_jeepney
pradyunsg commented 6 years ago

Heyo!

Yeah. We should print the number of compatible distributions found by platform and all.

I think there's an existing issue for this, or its mentioned in another issue somewhere. I don't have the time to look right now. =|

pradyunsg commented 6 years ago

Found it: https://github.com/pypa/pip/issues/4649#issuecomment-333675745

Leaving this issue open to track the number of compatible releases "not selected" being printed. :)

cowlinator commented 5 years ago

This error is misleading should be fixed. Please don't forget about this issue!

lyndsysimon commented 4 years ago

@cowlinator - it’s only a year later, but I was looking for something to contribute and will be picking this up. :)

lyndsysimon commented 4 years ago

Let’s make sure I understand this one. In the example above of keyring-jeepney, the package has a classifier of Programming Language :: Python :: 3, and the user is trying to install it in a cPython 2.x environment.

The desired state then would be something like this:

$ pip install --user keyring_jeepney
Collecting keyring_jeepney
  Could not find a version that is supported on your platform: `Python 2.7.17`
  Supported versions:
    - Programming Language :: Python :: 3
No matching distribution found for keyring_jeepney

If someone could review the above desired state I’d appreciate it. Once that’s confirmed I’ll figure out how to get the list of classifiers from the package and implement the change and associated tests.

Julian commented 4 years ago

I don't think the classifiers should be involved (though I haven't looked at the internals) -- but I'd be almost positive pip's notion of what discovered distributions are applicable is some other internal state (one using packaging probably, and coming from the filenames) -- so, I think you're on the right track, but to write out something without the classifier, here's perhaps a similar rough sketch of what I might personally hope for for one specific hypothetical case:

$ pip install --user keyring_jeepney
Collecting keyring_jeepney
  Could not find a version that is supported on your platform (CPython 3.6.3 on macOS)
  Found 2 unsuitable binary distributions:
    keyring_jeepney-0.3.2.whatever.whl ([in green]CPython3[endgreen] for [in red]Linux[endred])
    keyring_jeepney-0.4.7.whatever.whl ([in red]PyPy[endred] for [in green]macOS[endgreen])
  and no available source distribution.

Others may pipe up with improvements/suggestions, but I think something like that is at least in the ballpark.

And thanks again for trying to tackle this -- I think it'd be a big win (I can say anecdotally I probably have explained this specific error to >~20 people myself in #python).