Pip: Repeated message about cache being disabled if pip cache is run with sudo

Created on 26 Apr 2020  路  4Comments  路  Source: pypa/pip

Environment

  • pip version: pip 20.1.dev1
  • Python version: Python 3.8.2
  • OS: Mac OS 10.15.4

Description

Running pip cache commands with sudo print two messages about cache being disabled, one a Warning and other an Error. (The second error message was introduced recently in https://github.com/pypa/pip/pull/8124)

Expected behavior

Ideally only one message should be printed. Or the second message can be supplanted to distinguish the case between using sudo, or using --no-cache-dir (We have options.cache_dir = None in the former, and options.cache_dir = False in the latter

How to Reproduce

Run sudo pip cache <subcommand>

Output

$ sudo pip cache list
WARNING: The directory '/Users/devesh/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

ERROR: pip cache commands can not function since cache is disabled.
triage

Most helpful comment

I'm not particularly worried with that, as the output is quite easy to understand. The increased complexity to resolve this is probably not worth it.

All 4 comments

I'm not particularly worried with that, as the output is quite easy to understand. The increased complexity to resolve this is probably not worth it.

... and we don't recommend running pip with sudo anyway 馃檪

Agreed that if the output is good enough to understand currently, we shouldn't make changes to it which need a non-trivial amount of effort.

Should I go ahead and close the issue then?

Should I go ahead and close the issue then?

Yes please.

Was this page helpful?
0 / 5 - 0 ratings