Ubuntu: Changes in Python 2.6

Once in a while, I install Python packages from source using distutils. The distutils-powered setup.py script found in many packages installs software in /usr/local/ – quite useful because it doesn’t interfere with packages managed by your distribution. Since Ubuntu Jaunty and Python 2.6, this doesn’t work anymore.

Previously, your usual command python setup.py install installed packages in /usr/local/lib/pythonX.Y/site-packages/, depending on your Python version. As of Ubuntu Jaunty, Python 2.6 no longer has this directory in sys.path. Instead, it expects local packages in /usr/local/lib/python2.6/dist-packages/, so your locally installed packages are no longer found.

I learned from this posting that distutils now supports an --install-layout=deb switch that installs the package in /usr/local/lib/python2.6/dist-packages. The switch is accepted in distutils from Python 2.4 and 2.5, too, without having any effect, so you can always include it in your command line.

To sum things up, the new command line for installing python packages in /usr/local/ is

  python setup.py install --install-layout=deb

This probably applies to Debian systems as well, judging from the name choice of --install-layout‘s parameter. I updated my posting on stow to reflect this change.

This entry was posted in linux and tagged , , . Bookmark the permalink.

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 )

Connecting to %s