pip: Report language, abi, platform tags when "DistributionNotFound: No matching distribution" occurs

  • Pip version: 9.0.1
  • Python version: 2.7.7
  • Operating System: Linux / CentOS 5

Description:

Recently, Tensorflow upgraded their wheels to require an ABI tag of “cp27mu” from the previous required ABI tag of “none”. I didn’t realize this and was puzzled when I could not install the wheel as I had previously done. I was getting a “DistributionNotFound: No matching distribution found for tensorflow” message. Even after looking at the wheel names on pypi, it looked like there was a wheel that matched my Python install.

The problem turned out to be that my Python binary has an associated ABI tag of “cp27m” which is not compatible with “cp27mu”. I only realized this after putting some prints in the pip source.

It would be helpful for this information to be exposed by reporting the sets of (language, abi, platform) tags when their mismatch is the cause of a “no matching distribution” error message. I would say this should be printed by default, but I could see the argument for printing it only when the -v verbose command line option is specified. These details should not be shown when errors are due to a lack of distribution for a specified distribution name or when errors are due to a version mismatch.

From poking around, it looks like the tags for the current install are available from pep425tags.supported_tags, although it looks like there may be ways to specify other supported tags. These are checked in wheel.py/Wheel.supported(), although there may be other checks.

Perhaps the output could look like:

DistributionNotFound: No language, abi, and platform tag match found for tensorflow distribution.
Local pip install supports the following tags:
* language: 'cp27', 'py2', 'py22', 'py23', 'py24', 'py25', 'py26', 'py27'
* abi: 'cp27m', 'none'
* platform: 'any', 'linux_x86_64', 'manylinux1_x86_64'

What I’ve run:

$ pip install tensorflow

Collecting tensorflow
  Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 20 (14 by maintainers)

Most upvoted comments

The problem is not hypothetical – I’ve demonstrated the same on the PR. Furthermore, alternatives have been discussed and mentioned. And a concern being raised without suggesting how to resolve that concern is fairly normal.

Anyway, I don’t have the mental energy to explain why concensus building and addressing concerns raised by others is an important part of OSS (and many social systems) so I’ll skip that.

Regardless, thanks for your contribution!

Hahah. I found the pip debug comment. Any guesses what one of the motivating examples for it was? 😉

https://github.com/pypa/pip/issues/5813#issuecomment-441251264

FTR - I think we should move to a new issue to discuss pip debug, if that’s the way we want to expose this at the CLI level.

FYI, I posted a PR #6638 implementing an initial pip debug command. As was suggested above, it displays the list of compatible pep 425 tags. It also accepts the same --python-version, --platform, etc. options that pip install and download support so that one has a way to experiment and see what tags result in those cases, too.

pip developers, I’ve bumped this thread with a pull request that solves the problem. You’re welcome.

Someone objected without proposing an alternative. Fine.

As a long time open source developer and contributor, I have no illusions about how this process works. You have my contribution - it’s just one idea. As I’m not skilled at solving problems that don’t exist (hypothetical complaints about having too many tags) I’m afraid my contributions to this thread are stalled.

As I’ve shown with an external project that can be used to solve this problem - we don’t need to have a consensus to move the ball forward.

I could not find an issue where it was mentioned before but I like the idea of a pip debug command (somewhat like your pip tags but more general) to diagnose pip issues:

  • print pip version and python version/interpreter
  • print supported pep 425 tags
  • print installation path
  • print read configuration
  • inspect PATH issues
  • inspect installed packages & metadata
  • etc

(Possibly under different sub-commands)