# error: [Errno 2] No such file or directory: 'setup.py'

ERROR: Failed to build installable wheels for some pyproject.toml based projects (foo)

- **ID:** `python/pip-egg-info-failed-setup-py`
- **Domain:** python
- **Category:** install_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A build backend expects setup.py (legacy setuptools) but the package only has pyproject.toml, or the build backend is misconfigured to use setuptools.build_meta:__legacy__.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   Fix the build-system table in pyproject.toml:
  [build-system]
  requires = ["setuptools>=61", "wheel"]
  build-backend = "setuptools.build_meta"
(Not __legacy__, which requires setup.py.)
   ```
2. **** (85% success)
   ```
   If you maintain the package, switch to a modern backend (hatchling, poetry-core, flit) that does not need setup.py.
   ```

## Dead Ends

- **** — An empty setup.py does not declare metadata; the build produces an unusable package. (80% fail)
- **** — Isolation is not the issue; the backend cannot find the file it expects. (70% fail)
