Installing cinfony on MacOSX 10.5The following instructions take you through the process of installing cinfony and all of its dependencies. A brief word about installing Python packagesAfter extracting the .tar.gz file, Python packages are generally installed in one of two ways: - globally, with python2.5 setup.py install (requires root)
- locally, with python2.5 setup.py install --prefix=$HOME
- This requires the PYTHONPATH variable to be set to include the directory where the files were installed (in this case, $HOME/lib/python2.5/site-packages or so).
Prerequisites- Fink - Fink should be set to use the unstable repositories (see Fink documentation)
- Jython 2.2
- Python 2.5 from Fink - "fink install python25" (this will take a while), and update your PATH to use this Python (/sw/bin/python2.5)
Q: Why not use the System Python instead of Fink's Python? A: Because we are going to install Cairo, Pycairo and Python Imaging Library using Fink, and these require Fink's Python. But don't worry - the System Python will not harmed in any way. If you are not interested in the 2D drawing functionality or if you think you will be able to install the graphics libraries yourself, you could use the System Python instead. cinfony- Download and install cinfony 0.8
- Test at the Python prompt as follows:
>>> import cinfony If you want to draw 2D diagrams for any of pybel, rdkit and cdkjpype, you need to install the Python Imaging Library (PIL) - "fink install pil-py25"
- Test at the Python prompt as follows:
>>> import Image
>>> import ImageTk In order for Jython to find Cinfony, add a line to the registry file in the Jython installation directory as follows: - python.path = /usr/local/lib/python2.4/site-packages where you should replace the path by the path to the directory where Cinfony was installed
- Test at the Jython prompt as follows:
>>> import cinfony Cinfony contains five wrappers: - pybel - OpenBabel wrapper (CPython)
- jybel - OpenBabel wrapper (Jython)
- cdkjpype - CDK wrapper (CPython)
- cdkjython - CDK wrapper (Jython)
- rdkit - RDKit wrapper (CPython)
To install the dependencies for each wrapper, follow the appropriate instructions below. Note: there is no need to install the dependencies for a wrapper you are not going to use. OpenBabelOpenBabel is a C++ library and can be accessed from both CPython and Jython. pybel- Follow the instructions to compile and install the OpenBabel Python bindings
- Test at the Python prompt as follows:
>>> from cinfony import obabel
>>> print pybel.readstring("smi", "CCC").molwt
44.09562If you want to be able to create a 2D diagram of a molecule, you need to install OASA - OASA has a dependency on the Cairo library and its Python bindings, so use Fink to install these
- "fink install pycairo-py25" (this may take a while)
- Download and install the Python package OASA 0.12.1
- Test at the Python prompt as follows:
>>> from cinfony import obabel
>>> pybel.readstring("smi", "CCC").draw()jybelIn the following section $OB_SRCDIR refers to the directory where OpenBabel was extracted and compiled (something like /home/user/Tools/openbabel-2.2.0), and $OB_INSTALLDIR refers to the directory where it was installed (typically /usr/local/lib). - Download and extract the new OpenBabel Java bindings into the $OB_SRCDIR/scripts directory
- This creates a directory $OB_SRCDIR/scripts/newjava
- Follow the instructions in newjava/README to compile the OpenBabel Java bindings
- Add $OB_SRCDIR/scripts/newjava and $OB_INSTALLDIR to the DYLD_LIBRARY_PATH environment variable
- Add $OB_SRCDIR/scripts/newjava/openbabel.jar to the CLASSPATH environment variable
- Test at the Jython prompt as follows:
>>> from cinfony import obabel RDKitThe RDKit is a C++ library currently accessible only from CPython. - Download and extract RDKit May2008_1
- Follow the installation instructions
- Add the RDKit_May2008_1\Python directory to the PYTHONPATH environment variable
- Test at the Python prompt as follows:
>>> from cinfony import rdkit
>>> mol = rdkit.readstring("smi", "CCC")
>>> print mol.molwt
44.097
>>> mol.draw()CDKThe CDK is a Java library and can be accessed from both CPython and Jython. - Download CDK 1.0.3
- Add the cdk.1.0.3.jar file to your CLASSPATH environment variable (remember to include the full path to the jar file)
cdkjpype- Download and install JPype
- You need to set JAVA_HOME to the Java installation directory before running setup.py.
- Set JPYPE_JVM environment variable to point to the libjvm.so file in your Java installation directory
- On my system, it's /home/user/Tools/jdk1.5.0_16/jre/lib/i386/client/libjvm.so
- Add to the LD_LIBRARY_PATH environment variable, the directory in your Java installation containing libawt.so
- On my system, it's /home/user/Tools/jdk1.5.0_16/jre/lib/i386
- Test at the Python prompt as follows:
>>> from cinfony import cdk
>>> mol = cdk.readstring("smi", "CCC")
>>> mol.addh()
>>> print mol.molwt
44.0956192017If you want to be able to create a 2D diagram of a molecule, you need to install OASA (see installation instructions in the Pybel section above). - Test at the Python prompt as follows:
>>> from cinfony import cdk
>>> cdk.readstring("smi", "CCC").draw()cdkjython- At this point you should already have configured Jython to find Cinfony and have added the CDK jar to the CLASSPATH
- Test at the Jython prompt as follows:
>>> from cinfony import cdk
>>> cdk.readstring("smi", "CCC").draw()
|