# ModuleNotFoundError: No module named 'distutils'

- **ID:** `python/setuptools-distutils-removed-python312`
- **Domain:** python
- **Category:** module_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Python 3.12 removed the stdlib distutils module. Older setuptools versions and legacy setup.py scripts that import distutils directly fail. setuptools >= 60 provides a vendored distutils shim but only if SETUPTOOLS_USE_DISTUTILS is not set to stdlib.

## Version Compatibility

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

## Workarounds

1. **** (92% success)
   ```
   pip install --upgrade 'setuptools>=69' && export SETUPTOOLS_USE_DISTUTILS=local
   ```
2. **** (80% success)
   ```
   pip install standard-distutils  # or use setuptools>=60 which vendors it
   ```
3. **** (85% success)
   ```
   pyenv install 3.11.9 && pyenv local 3.11.9
   ```

## Dead Ends

- **** — No such package exists on PyPI; distutils was a stdlib module, not a distributable package. (95% fail)
- **** — Old setuptools (<60) does not provide the shim, so the import still fails downstream. (70% fail)
