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 wheel/install with non-writable cache fails despite warning the cache has been disabled #7488

Closed
sbidoul opened this issue Dec 15, 2019 · 0 comments · Fixed by #7489
Closed
Labels
auto-locked Outdated issues that have been locked by automation C: cache Dealing with cache and files in it type: bug A confirmed bug or unintended behavior

Comments

@sbidoul
Copy link
Member

sbidoul commented Dec 15, 2019

Coming from #7484

Environment

  • pip version: 19.3
  • Python version: 3.7 (probably irrelevant)
  • OS: linux (probably irrelevant)

Description

Running pip install and pip wheel with a non-writable cache directory leads to an install error, despite pip warning that the cache is disabled due to a permission or ownership issue.

Expected behavior

Installation or build should succeed with a warning that the cache is disabled.

How to Reproduce: pip install

$ mkdir cache
$ chmod -r cache
$ pip install wrapt --cache-dir=cache

Output

WARNING: The directory '/tmp/brol/cache/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory 'cache' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: 'cache/wheels/d7/de/2e/efa132238792efb6459a96e85916ef8597fcb3d2ae51590dfd'
Consider using the `--user` option or check the permissions.

pip wheel behaves similarly.

Analysis

For pip install the wheel cache is created before testing the cache is writable.

wheel_cache = WheelCache(options.cache_dir, options.format_control)
if options.cache_dir and not check_path_owner(options.cache_dir):
logger.warning(
"The directory '%s' or its parent directory is not owned "
"by the current user and caching wheels has been "
"disabled. check the permissions and owner of that "
"directory. If executing pip with sudo, you may want "
"sudo's -H flag.",
options.cache_dir,
)
options.cache_dir = None

For pip wheel, no such cache writability check is done.

@triage-new-issues triage-new-issues bot added the S: needs triage Issues/PRs that need to be triaged label Dec 15, 2019
@xavfernandez xavfernandez added C: cache Dealing with cache and files in it type: enhancement Improvements to functionality labels Dec 16, 2019
@triage-new-issues triage-new-issues bot removed the S: needs triage Issues/PRs that need to be triaged label Dec 16, 2019
@xavfernandez xavfernandez added type: bug A confirmed bug or unintended behavior and removed type: enhancement Improvements to functionality labels Dec 16, 2019
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jan 27, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jan 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation C: cache Dealing with cache and files in it type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants