# ModuleNotFoundError: No module named 'distutils'

- **ID:** `python/setup-py-deprecated-distutils-removed`
- **Domain:** python
- **Category:** module_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Python 3.12 removed the stdlib distutils module. Legacy setup.py scripts or old setuptools versions import distutils directly and fail.

## Version Compatibility

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

## Workarounds

1. **** (90% success)
   ```
   pip install 'setuptools>=68'
export SETUPTOOLS_USE_DISTUTILS=stdlib
pip install .
   ```
2. **** (85% success)
   ```
   pip install --upgrade setuptools
python -c "import setuptools, setuptools._distutils; print('ok')"
# if still failing, use build isolation:
pip install --use-pep517 .
   ```

## Dead Ends

- **** — There is no distutils package on PyPI; pip reports 'No matching distribution found for distutils'. (95% fail)
- **** — The module doesn't exist to import; the shim itself raises ModuleNotFoundError. (90% fail)
