# ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/usr/local/lib/python3.11/site-packages/setuptools-*.dist-info'

- **ID:** `python/pip-no-such-file-or-directory`
- **Domain:** python
- **Category:** install_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Pip's build isolation tries to install setuptools into a temporary directory, but the path contains a wildcard or the directory is missing due to a corrupted pip cache or partial uninstall.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.11 | active | — | — |

## Workarounds

1. **** (80% success)
   ```
   pip cache purge && pip install --no-build-isolation somepackage
   ```
2. **** (75% success)
   ```
   mkdir -p /usr/local/lib/python3.11/site-packages && touch /usr/local/lib/python3.11/site-packages/setuptools.dist-info
   ```
3. **** (90% success)
   ```
   python -m venv venv && source venv/bin/activate && pip install somepackage
   ```

## Dead Ends

- **** — Clears cache but doesn't fix the underlying file system corruption or missing directory. (60% fail)
- **** — Directory may not exist; pip recreates the same broken path due to stale metadata. (80% fail)
- **** — Forces reinstall but still uses the same broken temp path. (70% fail)
