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

Confusing pip behavior when trying to install a package with an outdated Python version #7797

Open
Nodraak opened this issue Feb 27, 2020 · 7 comments
Labels
C: error messages Improving error messages UX User experience related

Comments

@Nodraak
Copy link

Nodraak commented Feb 27, 2020

Hello,

Environment

  • pip version: 20.0.2
  • Python version: 3.5.3
  • OS: Debian 9 on WSL at work (yeah, not a simple setup)

Description

I have Python 3.5, and wanted to upgrade Matplotlib version from 3.0.3 to 3.1.3. I just found out that it requires Python 3.6, but Pip never told me that, and its behavior was very confusing (no message of any kind).

Expected behavior

I think that Pip should tell the user why a specific version can not be installed when the requirements are not satisfied. Or at least have a generic message like "If you believe this package/version does exist, check that your installation fulfill the package requirements from its setup.py file".

How to Reproduce / Output

Have Python <3.6 (for ex 3.5), and run:

# pip search sees latest version
$ python3 -m pip  search matplotlib | grep "Python plotting package"
matplotlib (3.1.3)                 - Python plotting package

# but pip install does not. No message of any kind to explain why
$ python3 -m pip install --upgrade matplotlib
Defaulting to user installation because normal site-packages is not writeable
Requirement already up-to-date: matplotlib in ./.local/lib/python3.5/site-packages (3.0.3)
[...]

# let's try again and specify the exact version. Again, no message explaining why
$ python3 -m pip install matplotlib==3.1.3
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement matplotlib==3.1.3 (from versions: 0.86, 0.86.1, 0.86.2, 0.91.0, 0.91.1, 1.0.1, 1.1.0, 1.1.1, 1.2.0, 1.2.1, 1.3.0, 1.3.1, 1.4.0, 1.4.1rc1, 1.4.1, 1.4.2, 1.4.3, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 2.0.0b1, 2.0.0b2, 2.0.0b3, 2.0.0b4, 2.0.0rc1, 2.0.0rc2, 2.0.0, 2.0.1, 2.0.2, 2.1.0rc1, 2.1.0, 2.1.1, 2.1.2, 2.2.0rc1, 2.2.0, 2.2.2, 2.2.3, 2.2.4, 2.2.5, 3.0.0rc2, 3.0.0, 3.0.1, 3.0.2, 3.0.3)
ERROR: No matching distribution found for matplotlib==3.1.3
@triage-new-issues triage-new-issues bot added the S: needs triage Issues/PRs that need to be triaged label Feb 27, 2020
@uranusjr
Copy link
Member

This is essentially a special case to #6526. Probably could be marked as duplicate.

@Nodraak
Copy link
Author

Nodraak commented Feb 27, 2020

Indeed, you are correct.

With python3 -m pip install matplotlib==3.1.3 -vvv I can see (tons of lines, and) Link requires a different Python (3.5.3 not in: '>=3.6').
It would be great if this message was printed without the -vvv flags.

The discussion of the issue you linked is quite long, I'm not sure what is the status.

@uranusjr
Copy link
Member

The state is everyone agrees this needs fixing, but not quite sure how. A pull request to prototype the implementation would be quite useful IMO, if someone’s willing to do it.

@anudit
Copy link
Contributor

anudit commented Feb 28, 2020

Switching from a logger.debug to a logger.info should give the user more details on if there was a python version requirement that wasn't fulfilled. Happy to take this on, @uranusjr.

logger.debug(
'Link requires a different Python (%s not in: %r): %s',
version, link.requires_python, link,
)

@uranusjr
Copy link
Member

The message probably needs some rewording as well; I’d imagine people be confused unless they are already familiar with how the package index works. Feel free to work on this.

@pradyunsg pradyunsg modified the milestones: Improve User Experience, Print Better Error Messages Mar 1, 2020
@xavfernandez
Copy link
Member

Switching from a logger.debug to a logger.info should give the user more details on if there was a python version requirement that wasn't fulfilled.

We definitely want something smarter than that.

Otherwise, we'd go from (using Python 2):

$ pip install numpy
Looking in indexes: https://pypi.org/simple/
Collecting numpy
  Using cached numpy-1.16.6-cp27-cp27mu-manylinux1_x86_64.whl (17.0 MB)
Installing collected packages: numpy
Successfully installed numpy-1.16.6

to

$ pip install numpy
Looking in indexes: https://pypi.org/simple/
  Link requires a different Python (2.7.17 not in: u'>=3.5'): https://files.pythonhosted.org/packages/c1/ff/aeb22192bab0643551a161dc4ed305892cead687ee97453daed4dc1dd38e/numpy-1.17.0rc1.zip#sha256=f53df05f9ca4ec5d72709ffe349704f1f7d945ed59e815574b5c5687acb282c4 (from https://pypi.org/simple/numpy/) (requires-python:>=3.5)
  Link requires a different Python (2.7.17 not in: u'>=3.5'): https://files.pythonhosted.org/packages/93/9b/443bbd1b38c4e5617f32c14c1494ae884d36cf3870c33828bb32e4b00dea/numpy-1.17.0rc2.zip#sha256=a4153fe85cf92a796022b81b138000160dea840cad13b7d1db67cfec594ece23 (from https://pypi.org/simple/numpy/) (requires-python:>=3.5)
  Link requires a different Python (2.7.17 not in: u'>=3.5'): https://files.pythonhosted.org/packages/da/32/1b8f2bb5fb50e4db68543eb85ce37b9fa6660cd05b58bddfafafa7ed62da/numpy-1.17.0.zip#sha256=951fefe2fb73f84c620bec4e001e80a80ddaa1b84dce244ded7f1e0cbe0ed34a (from https://pypi.org/simple/numpy/) (requires-python:>=3.5)
  Link requires a different Python (2.7.17 not in: u'>=3.5'): https://files.pythonhosted.org/packages/cb/79/96df883cd6df0c86cb010e6f4ff790b7a30a45016a9509c94ea72c8695cd/numpy-1.17.1.zip#sha256=f11331530f0eff69a758d62c2461cd98cdc2eae0147279d8fc86e0464eb7e8ca (from https://pypi.org/simple/numpy/) (requires-python:>=3.5)
  Link requires a different Python (2.7.17 not in: u'>=3.5'): https://files.pythonhosted.org/packages/ac/36/325b27ef698684c38b1fe2e546e2e7ef9cecd7037bcdb35c87efec4356af/numpy-1.17.2.zip#sha256=73615d3edc84dd7c4aeb212fa3748fb83217e00d201875a47327f55363cef2df (from https://pypi.org/simple/numpy/) (requires-python:>=3.5)
  Link requires a different Python (2.7.17 not in: u'>=3.5'): https://files.pythonhosted.org/packages/b6/d6/be8f975f5322336f62371c9abeb936d592c98c047ad63035f1b38ae08efe/numpy-1.17.3.zip#sha256=a0678793096205a4d784bd99f32803ba8100f639cf3b932dc63b21621390ea7e (from https://pypi.org/simple/numpy/) (requires-python:>=3.5)
  Link requires a different Python (2.7.17 not in: u'>=3.5'): https://files.pythonhosted.org/packages/ff/59/d3f6d46aa1fd220d020bdd61e76ca51f6548c6ad6d24ddb614f4037cf49d/numpy-1.17.4.zip#sha256=f58913e9227400f1395c7b800503ebfdb0772f1c33ff8cb4d6451c06cabdf316 (from https://pypi.org/simple/numpy/) (requires-python:>=3.5)
  Link requires a different Python (2.7.17 not in: u'>=3.5'): https://files.pythonhosted.org/packages/d9/09/8e89c05abc450ea347f40b4fa917ec5c69b5228da344487f178586a3187c/numpy-1.17.5.zip#sha256=16507ba6617f62ae3c6ab1725ae6f550331025d4d9a369b83f6d5a470446c342 (from https://pypi.org/simple/numpy/) (requires-python:>=3.5)
  Link requires a different Python (2.7.17 not in: u'>=3.5'): https://files.pythonhosted.org/packages/21/94/5d48401d922ad494399f74a973445d831c888ef0cd9437a4276d8a63cfe5/numpy-1.18.0rc1.zip#sha256=7b0b915190cf60e691c17147f5d955e273d4c482b795a7bb168ad4a2fe2fb180 (from https://pypi.org/simple/numpy/) (requires-python:>=3.5)
  Link requires a different Python (2.7.17 not in: u'>=3.5'): https://files.pythonhosted.org/packages/31/0a/5df350c29a06835d534a6c4f5681075304da38d85f1c69e5226a635a67ce/numpy-1.18.0.zip#sha256=a9d72d9abaf65628f0f31bbb573b7d9304e43b1e6bbae43149c17737a42764c4 (from https://pypi.org/simple/numpy/) (requires-python:>=3.5)
  Link requires a different Python (2.7.17 not in: u'>=3.5'): https://files.pythonhosted.org/packages/40/de/0ea5092b8bfd2e3aa6fdbb2e499a9f9adf810992884d414defc1573dca3f/numpy-1.18.1.zip#sha256=b6ff59cee96b454516e47e7721098e6ceebef435e3e21ac2d6c3b8b02628eb77 (from https://pypi.org/simple/numpy/) (requires-python:>=3.5)
Collecting numpy
  Using cached numpy-1.16.6-cp27-cp27mu-manylinux1_x86_64.whl (17.0 MB)
Installing collected packages: numpy
Successfully installed numpy-1.16.6

I think something based on #6119 to easily output the useful information when needed would be a better direction.

@nlhkabu nlhkabu added the C: error messages Improving error messages label Jul 28, 2020
@triage-new-issues triage-new-issues bot removed the S: needs triage Issues/PRs that need to be triaged label Jul 28, 2020
@nlhkabu nlhkabu added the UX User experience related label Jul 28, 2020
@nlhkabu nlhkabu removed this from the Print Better Error Messages milestone Jul 29, 2020
@froli-code
Copy link
Contributor

I have just recreated this issue with python 3.6.15 and pip 21.3.1 on Manjaro 22.0.0.

I installed my own test package (requiring python 3.6) and tried to upgrade to a new version of said package requiring python 3.7.

The following error message was generated:

ERROR: Package 'example-package-froli1' requires a different Python: 3.6.15 not in '>=3.7'

Based on this result I'd say that the underlying issue was fixed.
Can you verify this as well @Nodraak , so we might possibly close this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: error messages Improving error messages UX User experience related
Projects
None yet
Development

No branches or pull requests

7 participants