# ModuleNotFoundError: No module named 'distutils'

**Code:** `No module named distutils` · **Category:** Python · **Seen on:** Python

Python 3.12 removed distutils; old packages or tools that import it fail.

## Meaning

distutils was deprecated in 3.10 and removed in 3.12. Old versions of numpy, node-gyp, virtualenv and setup.py scripts still import it.

## Common causes

- Running old packages on Python 3.12+
- Old setup.py-based builds
- node-gyp using system Python 3.12

## Quick fix

1. Install setuptools (provides a distutils shim): pip install setuptools
2. Upgrade the failing package
3. Use Python 3.11 for legacy projects

## Detailed fix by platform

### Python

1. `python -m pip install -U setuptools`

## How to diagnose

1. **Version** — python --version
2. **Package** — Which package imports distutils?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/python/modulenotfounderror-distutils)
