# ERROR: Could not install packages due to an OSError: [Errno 30] Read-only file system: '/root/.cache/pip/http'

- **ID:** `pip/cache-read-only-filesystem`
- **Domain:** pip
- **Category:** system_error
- **Error Code:** `ERROR`
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

pip's cache directory is located on a read-only filesystem (e.g., in a container, CI environment, or mounted volume with read-only permissions), preventing pip from writing or updating cached files.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| pip 23.0 | active | — | — |
| pip 24.0 | active | — | — |
| pip 24.2 | active | — | — |

## Workarounds

1. **Disable pip's cache entirely: pip install --no-cache-dir <package>** (95% success)
   ```
   Disable pip's cache entirely: pip install --no-cache-dir <package>
   ```
2. **Set PIP_CACHE_DIR environment variable to a writable location: export PIP_CACHE_DIR=/tmp/pip-cache && pip install <package>** (90% success)
   ```
   Set PIP_CACHE_DIR environment variable to a writable location: export PIP_CACHE_DIR=/tmp/pip-cache && pip install <package>
   ```

## Dead Ends

- **Run pip with sudo or as root to override permissions** — The filesystem is genuinely read-only (e.g., mounted with -o ro); root cannot write to a read-only filesystem either. This often happens in Docker containers where the volume is mounted read-only. (90% fail)
- **Delete the cache directory manually with rm -rf /root/.cache/pip** — Deletion also requires write permission to the filesystem; the same read-only restriction applies. (95% fail)
