Differences between revisions 13 and 14
Revision 13 as of 2013-06-09 17:47:24
Size: 4004
Comment:
Revision 14 as of 2013-06-25 14:00:14
Size: 4006
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
To make a long story short, I've switched my packages to use [[PyPi:distribute]] instead of [[PyPi:setuptools]]. Distribute is an actively maintained fork of setuptools and provides the setuptools package name. I expect distribute to be "the way of the future".

The need for this change came from Python 2.6.3, which broke every C/C++ extension on the planet that was shipped using setuptools (which includes PyCuda, [[PyOpenCL]], and many more of my packages.) Python 2.6.4 eventually fixed the issue.
Line 15: Line 12:

To make a long story short, I've switched my packages to use [[PyPi:distribute]] instead of [[PyPi:setuptools]]. Distribute is an actively maintained fork of setuptools and provides the setuptools package name. I expect distribute to be "the way of the future".

The need for this change came from Python 2.6.3, which broke every C/C++ extension on the planet that was shipped using setuptools (which includes PyCuda, [[PyOpenCL]], and many more of my packages.) Python 2.6.4 eventually fixed the issue.

The Story about Distribute and Setuptools

As of June 2013, distribute and setuptools have been re-merged, and this page has become moot. I've switched back to setuptools, because something broke distribute. Grr. See the setuptools docs for more info.

To make a long story short, I've switched my packages to use distribute instead of setuptools. Distribute is an actively maintained fork of setuptools and provides the setuptools package name. I expect distribute to be "the way of the future".

The need for this change came from Python 2.6.3, which broke every C/C++ extension on the planet that was shipped using setuptools (which includes PyCuda, PyOpenCL, and many more of my packages.) Python 2.6.4 eventually fixed the issue.

How to switch to Distribute

Step 1: Completely Remove Setuptools

First, check if setuptools was installed using the package manager. In Debian and Ubuntu, do

sudo apt-get remove --purge python-setuptools python-virtualenv

to be sure.

Update 8/11/2010: When you install setuptools in Debian unstable nowadays, you actually get distribute.

Once that's done, try

Python 2.5.4 (r254:67916, Sep 26 2009, 08:19:36)
[GCC 4.3.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import setuptools
>>> setuptools.__file__
'/usr/lib/python2.5/site-packages/setuptools/__init__.pyc'
>>>

If setuptools is still found, delete it:

$ sudo rm -Rf /usr/lib/python2.5/site-packages/setuptools

where you obviously need to subsitute the path that was found for setuptools above.

For completeness, also get rid of easy_install:

$ which easy_install
/usr/bin/easy_install
$ sudo rm /usr/bin/easy_install

Repeat until no more copies of setuptools are found. Then repeat with distribute instead of setuptools.

Step 2: Download and Unpack Distribute

Download distribute from here, unpack, install:

$ tar xvfz distribute-x.y.z.tar.gz
$ cd distribute-x.y.z
$ [sudo?] python setup.py install

Step 3: Install virtualenv (Optional)

If you use virtualenv prior to version 1.5.1, note that you need to use the command line option --distribute to force the use of distribute rather than setuptools. Distribute seems to have become the new default. virtualenv-distribute, a former solution to using distribute with virtualenv, does not work any more.

Error Messages and Solutions

KeyError: '_something'

Does your error message look like this?

"/usr/local/lib/python2.6/dist-packages/setuptools-0.6c9-
py2.6.egg/setuptools/command/build_ext.py",
line 85, in get_ext_filename
KeyError: '_something'

You are using Python 2.6.3 with Setuptools. This will not work. Uninstall setuptools, install distribute.

Invalid Command 'develop'

Does your error message look like this?

Scanning installed packages
Setuptools installation detected at /home/schwede/PIC_Hedge/pytools
Non-egg installation
Removing elements out of the way...
Already patched.
/home/schwede/PIC_Hedge/pytools/setuptools-0.6c9-py2.6.egg-info already patched.
Extracting in /tmp/tmpGSNq8D
Now working in /tmp/tmpGSNq8D/distribute-0.6.4
Building a Distribute egg in /home/schwede/PIC_Hedge/pytools
/home/schwede/PIC_Hedge/pytools/setuptools-0.6c9-py2.6.egg-info already exists
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: invalid command 'develop'

You've managed to install both setuptools and distribute. This shouldn't happen. To clean up the mess, follow the steps above.

DistributeVsSetuptools (last edited 2013-06-25 14:00:14 by AndreasKloeckner)