# How to install Python and PyDaylight 0) You will need a working C and C++ compiler. Gcc will work for everything. 1) Download and install Tcl/Tk from scriptics.com I've tested Python with versions 8.0, 8.2 and 8.3. You need Tcl to run dayswig since the converter from toolkit .h files to Swig .i file is written in Tcl. You do not need Tk, but PyDaylight supports drawing depictions onto a Tk canvas, which may be useful. 2) Readline library Download and install the readline library from ftp://ftp.gnu.org/pub/gnu/readline/readline-4.0.tar.gz Readline is not required to run Python. What it does is allow editing in interactive use very much like what bash and tcsh allow (eg, emacs or vi style editing and history). This is very useful. 3) JPEG and zlib libraries These are highly suggested if you want to use the Python Imaging Library (and you want to use PIL :) JPEG is used for JPEG files, and zlib is used for PNG files. JPEG - ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz zlib - ftp://ftp.cdrom.com/pub/infozip/zlib/zlib.tar.gz 4) Python Finally, Python itself. Download and install Python from http://www.python.org/ftp/python/src/py152.tgz . Follow the instructions in the README. Note: there are several bugs in older SGI compilers. Read the README for details. If you have installed readline, Tcl/Tk and zlib, then you can edit those lines in Modules/Setup. You do not need to configure PIL in the Setup. The new parts of my Setup file are (for an SGI): - - - - - - - - - - - - - - - - - - - - - - - - # GNU readline. readline readline.c -L/usr/local/lib -lreadline -ltermcap -I/usr/local/include # *** Always uncomment this (leave the leading underscore in!): _tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \ # *** Uncomment and edit to reflect where your Tcl/Tk headers are: -I/usr/local/include \ # *** Uncomment and edit to reflect where your X11 header files are: -I/usr/include/X11 \ # *** Uncomment and edit to reflect where your Tcl/Tk libraries are: -L/usr/local/lib \ # *** Uncomment and edit to reflect your Tcl/Tk versions: -ltk8.3 -ltcl8.3 \ # *** Always uncomment this; X11 libraries to link with: -lX11 # Andrew Kuchling's zlib module. zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz - - - - - - - - - - - - - - - - - - - - - - - - and for Solaris 5) PIL, the Python Imaging Library Download and install PIL from http://www.pythonware.com/downloads/Imaging-1.0.tar.gz You will need to edit Setup to use -ltcl8.3 and -ltk8.3 instead of the current 8.0 value. Most likely you'll do this after you get the error message about not finding libtcl8.0 -- I did :) ALSO! The installation instructions are in error. They assume a "site-packages" directory exists, which doesn't seem to always be the case. The also use "Python1.5" instead of "python1.5" as the Python installation directory name. Instead, use these instructions: (it's okay if this fails if the directory already exists) $ mkdir /usr/local/lib/python1.5/site-packages $ mkdir /usr/local/lib/python1.5/site-packages/PIL $ cp PIL.pth /usr/local/lib/python1.5/site-packages $ cp _imaging.so PIL/* /usr/local/lib/python1.5/site-packages/PIL 6) PIL fonts If you want to draw text with PIL, you need fonts. Prebuilt fonts are available in Dave Ascher's Snow package. To install the fonts, download and unpack Snow from: http://starship.python.net:9673/crew/da/Code/Snow/dists/FULL_Snow_1999_3_10.tar.gz $ cd Snow/shared/ $ cp -r pilfonts /usr/local/lib/python1.5/site-packages $ echo "pilfonts" > /usr/local/lib/python1.5/site-packages/pilfonts.pth $ rm /usr/local/lib/python1.5/site-packages/pilfonts/*.py 7) SWIG This is needed to compile dayswig, which is needed by PyDaylight. SWIG is available from www.swig.org. You will need the maintenance release. The 1.1p5 version will not work. nor will 1.3a1. The specific version I've used is 1.1-883 from: ftp://swig.cs.uchicago.edu/pub/SWIG/maintenance/swig1.1-883.tar.gz Oh, and you don't need to install the runtime libraries. 8) dayswig Get and install dayswig from ftp://starship.python.net/crew/dalke/dayswig-python-0.3.tar.gz (This is a modified version of Roger Critchlow's original code.) It should be easy - just do "make python". Note: If "./make-dayswig" will not run, the problem is the tclsh location. When you installed Tcl/Tk, tclsh got installed as "tclsh8.3". You will need to edit the top of "make-dayswig" to point to this version of tclsh, or make a symlink from tclsh8.3 to /usr/local/bin/tclsh . For consistency, you should also make a symlink for "wish8.3", which is the Tk shell. Heed the comment in the Makefile! # If you get the message: # ld32: FATAL 12: Expecting n32 objects: [...]/libdt_thor.so is o32. # then uncomment "LIBABI=32" ! If you get this message, uncomment 32 (which tells dayswig to look in Daylight's lib32 directory) then "make clean" followed by "make python". 9) PyDaylight The latest version of PyDaylight is 0.7, which will be released during MUG 2000 and will be available from: ftp://starship.python.net/pub/crew/dalke/daylight-0.7.tar.gz Once it's installed, you should be able to run: from daylight import Smiles mol = Smiles.smilin("c1ccccc1") print len(mol.atoms), len(mol.bonds), len(mol.cycles) and get "6 6 1" as output. 10) Editors You should get an editor which understands Python syntax. There are three I can recommend 1) xemacs, from www.xemacs.org 2) vim, from www.vim.org; this is an improved version of vi 3) idle, from www.python.org/idle/ is written in Python and includes a Python class browser 11) Go to http://starship.python.net/crew/dalke/PyDaylight/ for PyDaylight examples.