python
system_error
ai_generated
true
WARNING: Cache entry deserialization failed, entry ignored ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/root/.cache/pip/http-v2/...'
ID: python/pip-cache-write-permission-denied
80%Fix Rate
88%Confidence
0Evidence
2024-06-04First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
Root Cause
pip is running as a different user than the one that owns the pip cache directory, or the cache was created by root and now a non-root user tries to write to it.
generic中文
pip 运行的用户与拥有 pip 缓存目录的用户不同,或缓存由 root 创建,现在非 root 用户尝试写入。
Workarounds
-
90% success
Fix ownership or use a user-local cache: sudo chown -R $USER:$USER ~/.cache/pip Or: export PIP_CACHE_DIR=$HOME/.cache/pip-user mkdir -p $PIP_CACHE_DIR pip install <package>
-
85% success
Bypass the cache entirely for this install: pip install --no-cache-dir <package>
Dead Ends
Common approaches that don't work:
-
60% fail
Running as root fixes the immediate error but pollutes site-packages and can break the system Python.
-
50% fail
World-writable cache is a security risk and may still fail if the parent dir is not writable.