# ERROR: Could not install packages due to an EnvironmentError: [Errno 39] Directory not empty: '.../src/package.egg-info'

- **ID:** `python/pip-egg-info-dir-error`
- **Domain:** python
- **Category:** system_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A stale .egg-info directory exists from a previous build, and pip's cleanup fails because the directory is not empty.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |

## Workarounds

1. **Manually remove the .egg-info directory and its contents** (95% success)
   ```
   `rm -rf src/package.egg-info` then re-run `pip install .`
   ```
2. **Use `pip install --no-build-isolation` to avoid build isolation issues** (80% success)
   ```
   `pip install --no-build-isolation .`
   ```

## Dead Ends

- **Deleting the .egg-info directory manually but not the contents** — If the directory is not fully removed, pip may still detect it and fail. (50% fail)
- **Running pip with `--no-clean`** — This flag skips cleanup after installation, but the error occurs during the build step, not after. (90% fail)
