Contortions (and eventual success) with pydistutils.cfg

I finally upgraded to Snow Leopard (OS X 10.6) this past weekend, and the first order of business was to get Python configured the way I wanted.  I had previously been using a very custom install based on the old “Intel Mac Python 2.5” notes that Robert Kern wrote up for ETS developers/users, and I had resolved to be more intentional and organized about how I managed the installation of Python packages on my new system.

So, I first installed EPD, the Enthought Python Distribution as a base. Then I created a ~/.pydistutils.cfg file with the contents as outlined in the Python docs on Installing Python Packages:

[install]
install-base=$HOME/Library/Python2.6
install-purelib=site-packages
install-platlib=plat-mac
install-scripts=scripts
install-data=data

I then tried to install Mercurial using the one-liner:


$ easy_install mercurial

And I was promptly greeted with the error:


error: install-base or install-platbase supplied, but installation scheme is incomplete

WTF?

Google turned up nothing of substance, save for a link to an old subversion commit of distutils/commands/install.py. Taking this as a sign, I opened up my local copy of the file and a brief code read revealed the source of the problem: I was missing the install-headers option. So, I added the line:

    install-headers=Include

And was greeted by a different error:

install_dir site-packages/
TEST FAILED: site-packages/ does NOT support .pth files
error: bad install directory or PYTHONPATH

You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from.  The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    site-packages/

and your PYTHONPATH environment variable currently contains:

    '/Users/pwang/Library/Python2.6/site-packages:/Users/pwang/Library/Python2.6/plat-mac:'

Well, this was most disheartening. I was, after all, following the Python docs, which seem to imply that install-purelib would be appended to install-base. The above error message suggests that this was not the case, so I went back to the distutils source, and more code reading and tracing seemed to confirm this. So, I added an explicit $base to all of the config lines in my pydistutils.cfg, with a final result that looked like this:

[install]
install-base=$HOME/Library/Python2.6
install-purelib=$base/site-packages
install-platlib=$base/plat-mac
install-headers=$base/Include
install-scripts=$base/scripts
install-data=$base/data

This, finally, seemed to work. easy_install mercurial worked great, and everything installed into the proper locations. One thing to note was that the $base variable in pydistutils.cfg needs to be lower case.

Hopefully this entry will turn up the next time someone searches for “install-base or install-platbase supplied, but installation scheme is incomplete” and they are spared having to dig through the distutils source.

Advertisements

2 thoughts on “Contortions (and eventual success) with pydistutils.cfg

  1. Python Newbie says:

    Thank you very much. In fact I just googled “install-base or install-platbase supplied, but installation scheme is incomplete”, and luckily found your advice. Seems that the Python documentation is quite f***ed up.

  2. Greg says:

    Great advice. I don’t get how the official docs were incomplete as I am sure we are not alone with this issue.

    You fixed a problem I had been having. You have my gratitude. Now it’s my turn to post something useful for the next person!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: