No module named distutils Python Origin: Application & API Last updated 15 Oct 2026

ModuleNotFoundError: No module named 'distutils'

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

Exact message you may see No module named 'distutils'
Seen on: Python

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?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

0x8007007E — 0x8007007E: The specified module could not be found (Windows)0x8007007E0xC1900101 — Windows upgrade error 0xC1900101 (driver error, rolled back) (Windows)0xC1900101cookies() should be awaited — Next.js 15: Route "/x" used `cookies().get('token')`. `cookies()` should be awaited before using its value (Next.js)cookies() should be a…Could not resolve — Gradle: Could not resolve all files for configuration / Could not resolve dependency (Android)Could not resolveDependency requires compileSdk — Dependency 'androidx.x:1.y' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs (Android)Dependency requires c…Duplicate class — Duplicate class X found in modules A and B (Android)Duplicate classGLIBC_2.xx not found — /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (Linux)GLIBC_2.xx not foundgyp ERR! — gyp ERR! build error / node-gyp rebuild failed (npm)gyp ERR!No module…

Explore the map of this error Full error map →

🧠 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.