Short tip: Python TypeError: __init__() takes exactly 2 arguments (4 given)

Recently, I stumbled upon the following issue while installing a Python utility on an older CentOS system:

# python install
Traceback (most recent call last):
  File "", line 102, in 
  File "/usr/lib64/python2.7/distutils/", line 152, in setup
  File "/usr/lib64/python2.7/distutils/", line 953, in run_commands
  File "/usr/lib64/python2.7/distutils/", line 972, in run_command
  File "/usr/lib/python2.7/site-packages/setuptools/command/", line 27, in run
  File "/usr/lib/python2.7/site-packages/setuptools/command/", line 129, in install_for_development
    self.process_distribution(None, self.dist, not self.no_deps)
  File "/usr/lib/python2.7/site-packages/setuptools/command/", line 701, in process_distribution
    distreq.project_name, distreq.specs, requirement.extras
TypeError: __init__() takes exactly 2 arguments (4 given)

The tool I wanted to install leverages the Python module setuptools for simplifying installation (easy_install). I ensured that the installation program syntax was correct – also, other tools were unable to install. Finally, I found out that the Python module was corrupted during numerous installations and uninstallations – re-installing it fixed the issue:

# yum reinstall python-setuptools

If re-installing the module is not working, it might also be an option to upgrade the module to a newer version using the Python package management:

pip install --upgrade setuptools

Sharing is caring

Leave a Reply