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:
1# python setup.py install
2Traceback (most recent call last):
3 File "setup.py", line 102, in
4 'katprep_snapshot=katprep.snapshot:cli',
5 File "/usr/lib64/python2.7/distutils/core.py", line 152, in setup
6 dist.run_commands()
7 File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands
8 self.run_command(cmd)
9 File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
10 cmd_obj.run()
11 File "/usr/lib/python2.7/site-packages/setuptools/command/develop.py", line 27, in run
12 self.install_for_development()
13 File "/usr/lib/python2.7/site-packages/setuptools/command/develop.py", line 129, in install_for_development
14 self.process_distribution(None, self.dist, not self.no_deps)
15 File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 701, in process_distribution
16 distreq.project_name, distreq.specs, requirement.extras
17TypeError: __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:
1# 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:
1# pip install --upgrade setuptools