MySQLdb install vs. "setuptools"

John Nagle nagle at animats.com
Sun May 30 02:56:39 EDT 2010


    MySQLdb won't install as non-root on Python 2.6 because
its "setup.py" file requires "setuptools".  "setuptools",
unlike "distutils", isn't part of the Python 2.6 distribution.

    IMPORTANT PACKAGES SHOULD NOT USE "setuptools".  Use the
standard "distutils".  "setuptools" and "eggs" create more
problems than they solve.  "setuptools" has many built-in
assumptions about where things are supposed to be, and they're
usually wrong.

    There's an "ez_setup.py" available for MySQLdb.  This tries to obtain and
install "setuptools".  But it wants too many privileges just to do a "build":

   The following error occurred while trying to add or remove files in the
    installation directory:

     [Errno 2] No such file or directory: 
'/usr/local/lib/python2.6/site-packages/test-easy-install-22015.write-test'

    That's because "setuptools" has a built-in ego trip of insisting that
it should be installed globally.  I'm running a freshly-built, but not
"installed" version of Python 2.6.  I'm trying to install a test version
of Python2.6 with some packages without running as root on a live server.

    It's not just MySQLdb that's broken by "setuptools".  See these
examples of other installation problems created by "setuptools":

http://blog.awarelabs.com/2008/installing-mysqldb-without-python-egg-problems/
http://mail.python.org/pipermail/pythonmac-sig/2009-March/021148.html
http://plone.org/documentation/error/permission-denied-python-eggs

    As soon as "setuptools" becomes involved, unnecessary headaches appear.
DO NOT USE SETUPTOOLS.  Either use "distutils", or go all the way and
provide a RPM for Linux and a .exe for Windows.

				John Nagle



More information about the Python-list mailing list