Traceback (most recent call last):
File "setup.py", line 2, in
ImportError: No module named 'setuptools'
How can I fix this error?
There are several ways to package, distribute and install Python modules and programs. The most popular tools are distutils and setuptools. distutils is the standard Python packaging tool, while setuptools is a more feature-rich alternative to distutils. For example, unlike distutils, setuptools supports package dependency management, and can search for third-party modules in PyPi (Python Package Index). This makes setuptools more user-friendly.
To install a Python application packaged with setuptools, you can use the following command.
setup.py will then use setuptools module to retrieve and build the package as well as all dependent modules. Naturally, you must make sure that setuptools is available on your system. Without setuptools, you will encounter the error: "ImportError: No module named 'setuptools'".
To install setuptools on Debian, Ubuntu or Mint:
For Python 3.X applications, install python3-setuptools instead.
On Red Hat based systems, setuptools comes pre-installed. For whatever reason if you want to install it, use the yum command.
Subscribe to Ask Xmodulo
Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!