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 show fails silently if package not found #6858

Closed
GadgetSteve opened this issue Aug 11, 2019 · 2 comments · Fixed by #6880

Comments

@GadgetSteve
Copy link
Contributor

@GadgetSteve GadgetSteve commented Aug 11, 2019

Environment
All

  • pip version:
    Up to 19.2.1

  • Python version:
    All

  • OS:
    All

Description
When you use pip show somepackage if somepackage is not found there is no output, this is not too bad when a single package is specified but when multiple ones are it is easy to fail to notice that one or more is missing. This was raised as a part of #5454 where trailing commas result in packages not being found.

Expected behavior

I would expect pip show to give a clear indication of any package_(s)_ that it does not find, preferably either at the begining or end of output where it is less likely to be missed as mentioned by @chrahunt in his comments on #5454 - some thing like:

The following package(s) are not installed: somepackage

How to Reproduce

type: pip show asdf asdfasdf gsdfgfg dfgd or any other random set of gibberish then try with 3 packages that you do have installed and one that you don't.

  1. type: pip show asdf asdfasdf gsdfgfg dfgd or any other random set of gibberish
  2. Then run pip show with some packages that you have and one that you don't or gibberish

Output

> python -mpip show asdf asdfasdf gsdfgfg dfgd 

> python -mpip show asdf requests requests-html
Name: requests
Version: 2.21.0
Summary: Python HTTP for Humans.
Home-page: http://python-requests.org
Author: Kenneth Reitz
Author-email: me@kennethreitz.org
License: Apache 2.0
Location: c:\python36_64\lib\site-packages
Requires: idna, chardet, certifi, urllib3
Required-by: yampy2, wikipedia, Sphinx, safety, requests-html, pypistats, plotly, pandas-datareader, osmnx, nbdime, moviepy, jupyterhub, jupyter-request
s, folium, cookiecutter, caniusepython3
---
Name: requests-html
Version: 0.10.0
Summary: HTML Parsing for Humans.
Home-page: https://github.com/kennethreitz/requests-html
Author: Kenneth Reitz
Author-email: me@kennethreitz.org
License: MIT
Location: c:\python36_64\lib\site-packagesRequires: pyppeteer, bs4, w3lib, requests, pyquery, fake-useragent, parseRequired-by:

Trying to spot the missing asdf in the above is not simple.

I agree with the sentiment that "Errors should never pass silently." and think that this is a case in point.

In the spirit of "Unless explicitly silenced." -q could suppress this message.

@chrahunt

This comment has been minimized.

Copy link
Member

@chrahunt chrahunt commented Aug 11, 2019

This seems reasonable to me. I think if we write to stderr then we don't necessarily need to implement a -q, which may be better evaluated in the context of all commands as part of #6099.

@GadgetSteve

This comment has been minimized.

Copy link
Contributor Author

@GadgetSteve GadgetSteve commented Aug 12, 2019

@chrahunt - I agree with leaving out the -q - Looking at #6758 it looks like the output should be to logging.info for consistency with the other code rather than just outputting directly to stderr. _This will currently output to stdout and later switch to stderr as a part of #6758 or some other resolution.

cjerdonek added a commit that referenced this issue Aug 18, 2019
#6858: Changes to report any missing packages in pip show
@lock lock bot added the S: auto-locked label Sep 17, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Sep 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants
You can’t perform that action at this time.