How to fix How to fix 'ModuleNotFoundError: No module named setuptools' in Python in Python

PythonINTERMEDIATEMEDIUMUpdated Dec 7, 2025ยท 134 views

setuptools is required to install packages from source. This error means setuptools is not installed in your Python environment.

Quick fix

Fixes How to fix 'ModuleNotFoundError: No module named setuptools' in Python

  1. Verify the root cause
  2. Apply the appropriate fix
  3. Retry the installation
python โ€” error
# How to fix 'ModuleNotFoundError: No module named setuptools' in Python

What this error means

setuptools is a Python module that pip uses to install packages and build wheels. When you run pip install on a package with source code or compiled extensions, pip uses setuptools to handle the installation. If setuptools is missing, pip cannot proceed.

Typical symptoms

  • pip install fails with 'No module named setuptools'
  • Error occurs during package installation or build
  • Works with one Python version but not another
  • Fresh Python installation fails to install packages
  • ImportError mentions setuptools
  • pip commands fail immediately
  • Works after installing setuptools

Common causes

  1. setuptools not installed in the Python environment
  2. Using system Python without setuptools installed
  3. Virtual environment created without setuptools
  4. Pip bootstrap failed
  5. setuptools accidentally uninstalled
  6. Using Python from a minimal installation
  7. Multiple Python versions with different setuptools availability

How to fix this error

1Verify the root cause

Review the error message above and identify which cause applies to your situation. Run additional diagnostics if needed.

2Apply the appropriate fix

Follow the corresponding solution from the causes section above.

3Retry the installation

Once you've addressed the root cause, try running 'pip install' again.

Frequently asked questions

What does "How to fix 'ModuleNotFoundError: No module named setuptools' in Python" mean?
setuptools is a Python module that pip uses to install packages and build wheels. When you run pip install on a package with source code or compiled extensions, pip uses setuptools to handle the installation. If setuptools is missing, pip cannot proceed.
How do I fix "How to fix 'ModuleNotFoundError: No module named setuptools' in Python"?
setuptools is required to install packages from source. This error means setuptools is not installed in your Python environment.
What causes "How to fix 'ModuleNotFoundError: No module named setuptools' in Python"?
setuptools not installed in the Python environment Using system Python without setuptools installed Virtual environment created without setuptools
Is the "How to fix 'ModuleNotFoundError: No module named setuptools' in Python" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading