Free accounting software

Python setuptools and get_python_version is not defined

If you run into the below error when using setuptools (setup.py), then it’s quite possible that you’re using an outdated version of Python’s setuptools. In particular, the python-setuptools package in the CentOS yum repository is too old.

Traceback (most recent call last):
File “setup.py”, line 19, in ?
File “/usr/lib64/python2.4/distutils/core.py”, line 149, in setup
File “/usr/lib64/python2.4/distutils/dist.py”, line 946, in run_commands
File “/usr/lib64/python2.4/distutils/dist.py”, line 966, in run_command
File “/usr/lib/python2.4/site-packages/setuptools/command/bdist_rpm.py”, line 28, in run
File “/usr/lib64/python2.4/distutils/command/bdist_rpm.py”, line 377, in run
self.move_file(rpm, self.dist_dir)
File “/usr/lib/python2.4/site-packages/setuptools/command/bdist_rpm.py”, line 20, in move_file
NameError: global name ‘get_python_version’ is not defined

Luckily, this is quite easy to fix; simply remove the RPM and download the latest version from http://pypi.python.org/pypi/setuptools then just run it with “sh” as if it was a normal shell script.

Tags: , , , ,

Leave a Reply

You must be logged in to post a comment.