Last modified: Sep 28, 2026
How to Install Setuptools in Python
Setuptools is a key package for Python developers. It helps you package projects and install other libraries. Many tools depend on it.
If setuptools is missing, you may see errors like ModuleNotFoundError: No module named 'setuptools'. This guide shows you how to install it on any system.
What Is Setuptools?
Setuptools is a library that makes Python packaging easier. It works with pip to install and manage packages. It also provides the setup.py file used in many projects.
Most modern Python versions include setuptools by default. But sometimes it is missing or outdated. You may need to install or upgrade it manually.
Check If Setuptools Is Installed
Before installing, check if setuptools is already there. Open your terminal or command prompt. Run this command:
python -m pip show setuptools
If setuptools is installed, you will see details like version and location. If not, you will get a warning that says the package is not found.
You can also try importing it in Python:
import setuptools
print(setuptools.__version__)
If this runs without errors, setuptools is ready. If you see an error, keep reading.
Install Setuptools with pip
The easiest way to install setuptools is using pip. Pip is the standard package manager for Python. Run this command in your terminal:
python -m pip install setuptools
This command downloads and installs the latest version. After it finishes, you should see a success message.
Successfully installed setuptools-68.0.0
Now setuptools is ready to use. You can verify it again with the check commands above.
Upgrade Setuptools to the Latest Version
Sometimes setuptools is installed but outdated. An old version can cause problems with new packages. To upgrade, use the --upgrade flag:
python -m pip install --upgrade setuptools
This replaces the old version with the newest one. It is a good habit to keep setuptools updated.
Install Setuptools on Different Systems
The command is mostly the same on all systems. But there are small differences. Here is what to use on each platform.
On Windows
On Windows, use py or python depending on your setup. Open Command Prompt and run:
py -m pip install setuptools
If you use the Microsoft Store version of Python, the python command works fine too.
On macOS and Linux
On macOS and Linux, you may need to use python3 instead of python. Run:
python3 -m pip install setuptools
On some Linux systems, pip may not be installed. You can install it with your package manager. For example, on Ubuntu use sudo apt install python3-pip.
Fix Permission Errors
Sometimes pip fails with a permission error. This happens when you install to a system folder. You can fix it in two ways.
First, install for your user only. Add the --user flag:
python -m pip install --user setuptools
Second, use a virtual environment. This keeps your packages separate and avoids permission issues.
Use a Virtual Environment
A virtual environment is a clean space for your project. It is a best practice in Python. It keeps setuptools and other packages isolated.
Create a virtual environment with this command:
python -m venv myenv
Then activate it. On Windows use:
myenv\Scripts\activate
On macOS and Linux use:
source myenv/bin/activate
Now install setuptools inside the environment:
pip install setuptools
This keeps your main Python installation clean. It also makes your project easier to share.
Common Errors and Fixes
Here are some common problems and how to solve them.
ModuleNotFoundError: This means setuptools is not installed. Run the install command again.
pip is not recognized: Pip may not be in your system path. Use python -m pip instead of just pip.
SSL certificate errors: This can happen on older systems. Upgrade pip first with python -m pip install --upgrade pip.
Old version conflicts: Some packages need a specific setuptools version. You can install a certain version like this:
python -m pip install setuptools==65.0.0
This is useful when a project requires an older release.
Verify the Installation
After installing, always verify. Run the version check again:
import setuptools
print(setuptools.__version__)
You should see a version number like 68.0.0. If you do, everything is working.
Why Setuptools Matters
Setuptools is more than just a package. It powers the install process for many libraries. Tools like easy_install and setup.py rely on it.
Without setuptools, you may struggle to install packages from source. It also helps you build your own packages. This makes it a must-have for any Python developer.
Conclusion
Installing setuptools in Python is simple. Use pip and the right command for your system. Check the version, upgrade when needed, and use a virtual environment for clean projects.
Now you can fix missing setuptools errors with confidence. Keep your tools updated and your projects will run smoothly.