python
system_error
ai_generated
true
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/root/.cache/pip'
ID: python/pip-cache-permission-denied
80%Fix Rate
88%Confidence
0Evidence
2024-04-18First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
pip is running as a user without write access to the cache directory, often because the cache was created by root or another user.
generic中文
pip 以无权写入缓存目录的用户身份运行,通常是因为缓存由 root 或其他用户创建。
Workarounds
-
95% success
pip install --cache-dir /tmp/pip-cache package
-
90% success
sudo chown -R $USER:$USER ~/.cache/pip
Dead Ends
Common approaches that don't work:
-
70% fail
Installs packages system-wide and may cause permission issues later; not recommended in virtualenvs.
-
60% fail
If you lack permission to delete it, the error persists; also loses cache benefits.