# ERROR: File "setup.py", line 1, in <module>
    from setuptools import setup
ModuleNotFoundError: No module named 'setuptools'

- **ID:** `python/pip-legacy-editable-develop-error`
- **Domain:** python
- **Category:** module_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The build environment (often an isolated PEP 517 env or a fresh venv) does not have setuptools installed, and the project's setup.py imports it unconditionally.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   Add a build-system table to pyproject.toml: [build-system]\nrequires = ["setuptools>=61", "wheel"]\nbuild-backend = "setuptools.build_meta"
   ```
2. **** (85% success)
   ```
   Install with build isolation disabled: pip install --no-build-isolation .
   ```
3. **** (90% success)
   ```
   Install setuptools in the active venv then run pip install -e . --no-build-isolation
   ```

## Dead Ends

- **** — setup.py must be evaluated before install_requires is processed, so the import fails first. (90% fail)
- **** — pip build isolation creates a fresh env for the build, so the host setuptools is not visible. (85% fail)
- **** — If the project still needs setup.py for dynamic metadata, removing it breaks the build entirely. (70% fail)
