How to Install Setuptools for Python on Linux

Setuptools is a fully-featured, stable, and actively maintained library that is aimed at facilitating the packaging of Python projects, which includes:

  • Python package and module definitions.
  • Distribution package metadata.
  • Test hooks.
  • Project installation.
  • Platform-specific details.
  • Python 3 support.

It comprises enhancements to the Python disutils (distribution utilities) that enable developers to more easily build and package their Python code, particularly ones that have dependencies on other packages.

[ You might also like: How to Install and Use Python-Mistune on Linux ]

In this guide, we illustrate how you can install the Python Setuptools package for Python on Linux.

Install Python and Python-PIP in Linux

The Python-setuptools package requires Python3 and PIP 3, which is a command-line program that enables you to install and manage Python packages.

Most of the modern Linux distributions now ships with Python3 and you can verify using the following command:

$ python3 -V
Check Python Version in Linux
Check Python Version in Linux

To install pip3 on Linux distributions, run the following command:

$ sudo apt install python3-pip      [On Debian, Ubuntu and Mint]
$ sudo yum install python3-pip      [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux]
$ sudo emerge --ask dev-python/pip  [On Gentoo Linux]
$ sudo pacman -S python-pip         [On Arch Linux]
$ sudo zypper install python3-pip   [On OpenSUSE]    

To confirm pip3 has been installed, execute the command:

$ pip3 --version
Check Python PIP Version in Linux
Check Python PIP Version in Linux

Install Setuptools for Python in Linux

With Python3 and pip3 installed, proceed and install the setuptools package as shown using pip as follows.

$ pip3 install setuptools

When the installation is complete, confirm that the setuptools package is installed.

$ pip3 list | grep -i setuptools

setuptools     45.2.0

In addition, you can access the Python shell and try to import the setuptools package as shown.

Check Python Setuptools in Linux
Check Python Setuptools in Linux

This is a confirmation that the Setuptools package for Python is installed.

That was a brief guide on how to install the Setuptools package for Python on Linux distributions. Your feedback is much welcome.

Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.