Last updated on September 23, 2020 by Dan Nanni
setup.py ("python setup.py install"). However, it failed with the following error message:
Traceback (most recent call last): File "setup.py", line 2, inHow can I fix this error?import setuptools ImportError: No module named 'setuptools'
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.
When you install a Python application packaged with setuptools, you use the following command.
$ python (or python3) setup.py install
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 fix this error, you need to install setuptools on your Linux system.
setuptools on LinuxTo install setuptools on Debian, Ubuntu or Mint:
$ sudo apt-get install python-setuptools
For Python 3.X applications, install python3-setuptools instead.
$ sudo apt-get install python3-setuptools
On Red Hat based systems, setuptools comes pre-installed. For whatever reason if you want to install it, use the yum command.
$ sudo yum python-setuptools
This website is made possible by minimal ads and your gracious donation via PayPal or credit card
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.
Xmodulo © 2021 ‒ About ‒ Write for Us ‒ Feed ‒ Powered by DigitalOcean