ModuleNotFoundError: No module named 'distutils'
Python 3.12 removed distutils; old packages or tools that import it fail.
No module named 'distutils' 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
- Install setuptools (provides a distutils shim): pip install setuptools
- Upgrade the failing package
- Use Python 3.11 for legacy projects
Detailed fix by platform
Python
python -m pip install -U setuptools
How to diagnose
- Version — python --version
- Package — Which package imports distutils?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Python
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 15 Oct 2026