-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Closed
Labels
C: cacheDealing with cache and files in itDealing with cache and files in itauto-lockedOutdated issues that have been locked by automationOutdated issues that have been locked by automationtype: bugA confirmed bug or unintended behaviorA confirmed bug or unintended behavior
Description
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=cacheOutput
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.
pip/src/pip/_internal/commands/install.py
Lines 331 to 342 in 81805a5
| 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.
Metadata
Metadata
Assignees
Labels
C: cacheDealing with cache and files in itDealing with cache and files in itauto-lockedOutdated issues that have been locked by automationOutdated issues that have been locked by automationtype: bugA confirmed bug or unintended behaviorA confirmed bug or unintended behavior