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

Comments

@sbidoul
Copy link
Member

@sbidoul 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.