[Twisted-Python] Re: twistd doesn't work

David Bolen db3l.net at gmail.com
Fri Sep 7 02:01:15 EDT 2007

"David Langford" <langford.d at gmail.com> writes:

>   I did have the latest Twisted 2.5.0 installed. But I don't think i had the
> latest python installed. I installed that and now python doesnt see twisted.
> I downloaded the latest tarball again and when i tried to install it (using
> python setup.py install) it tells me i need zope (which it didn't last
> time).

You're most likely just getting caught mixing different python
installations, which can be easy to do when you have multiple
interpreters on a system.

You just need to ensure you're installing against the right Python
runtime when you install the Twisted package.  In particular, make
sure you are running the Python executable you think you are when
running setup.py since it will install into the library location for
that Python executable.

Assuming you install the latest Python (say, Python 2.5.1 from the OS
X DMG image).  It will place its installation by default into the
paths mentioned earlier (but with 2.5 rather than 2.4) - e.g.:

/Library/Frameworks/Python.framework/Versions/2.5   or

(Current is normally a symbolic link to a specific version)

If you've installed more than one Python release, you'll have multiple
versioned directories (e.g., 2.4 and 2.5) and Current will link to
one, probably the last you installed.

The python executable is in the "bin" directory beneath that root
(which also holds external library scripts), and external library
python code will end up beneath lib/python2.5/site-packages from that

So the first thing to be absolutely sure about is that when you want
to install packages like Twisted (or any distutils based package) into
your python 2.5.1 installation, you must be sure to run the python
2.5.1 executable.  You can do that by making sure the above paths are
in your default shell path, adding them temporarily, explicitly using
the full path to the executable or whatever you are comfortable with.

When in doubt, start python by whatever method you choose, and verify the
version number in the startup banner.

Once you are sure of your python executable, simplest is to start with
a full Twisted 2.5.0 archive (such as Twisted-2.5.0.tar.bz2).  Unpack
that into a convenient directory.

Twisted does depend on the zope.interface package.  It includes an
appropriate copy of that package in the archive, but you need to
install it yourself.  So switch into the zope.interface-3.3.0
directory, and from within there run "sudo python setup.py install",
again making sure that the python you are running are the one you want
to install into.

After you do that you can do the same "sudo python setup.py install"
from the top level of the unpacked archive and it will install all the
Twisted projects.  Or if you just want some (say TwistedCore and
TwistedWeb), you can switch individually into each of those project
directories and run setup.py from there manually.

That should be all there is to it.

-- David

More information about the Twisted-Python mailing list