Installing Twisted

Installation

If you are on Windows, you may want to skip this and simply get the Windows Installer version of Twisted from the download page.

To install Twisted, just make sure the Twisted-$VERSION/ directory is in the "PYTHONPATH" environment variable. For example, if you extracted Twisted-0.19.0.tar.gz to /home/bob/, then you would have something like:

export PYTHONPATH=$PYTHONPATH:/home/bob/Twisted-0.19.0/

in your ~/.bash_profile, ~/.zshrc, ~/.cshrc, etc. If you use Windows NT, 2000, or XP, then set your environment variables by right-clicking on My Computer and selecting Properties. If you use some other version of windows, you'll need to set the variable at a command prompt, or in autoexec.bat, with the 'set' command.

If you'd like to install Twisted system-wide on your machine and into the default PYTHONPATH, you can use setup.py to do so:

# python ./setup.py install

Be sure to run setup.py with appropriate privileges (root under Unix).

Optional Compilation

There are a couple of small optional alternative implementations of pieces of Twisted that are in C for increased performance. If you don't run the installer, and you need these modules, you'll need to perform a couple of extra steps:

$ python ./setup.py build_ext

This will (eventually) generate some shared libraries (cBanana.so, cReactor.so) within a directory tree called 'build' under the Twisted directory.

If you don't go on to install the build results into a directory on the $PYTHONPATH, then you will need to create a couple of symlinks:

$ cd twisted/spread
$ ln -s ../../build/lib.linux-i686-2.1/twisted/spread/cBanana.so cBanana.so
$ cd ../internet
$ ln -s ../../build/lib.linux-i686-2.1/twisted/internet/cReactor.so cReactor.so

The exact details of the symlinks may vary based on your system.

Running Tests

See our unit tests run in a lovely Tkinter GUI, proving that the software is BugFree(TM):

% admin/runtests

Some of these tests will fail if you don't have the Python XML packages installed on your system.