Linux & OS X

Installing Python

Python is pre-installed on OS X, but may need to be installed for your Linux system. For Linux, it is preferable to use your system’s default package manager, such as yum or apt.

Alternatively, you could download the Python installer appropriate for your system from http://www.python.org/download/, and follow the given directions for installation.

Download the OpenEye Python Toolkit

You must download the tarball that matches the python version, operating system, and architecture of your target machine’s configuration.

Download from http://www.eyesopen.com/downloads.

Note

In order to follow the PEP 440 guidelines on version numbers you will notice the version number of the toolkit is altered from 2014.Jun.6 to 2014.6.6.

Installation options for the OpenEye Python Toolkit

There are multiple ways to install the OpenEye Python Toolkit. From the 2013.Oct release we have adopted to conform with the Python standards for packaging, our previous installation method is still available.

  1. The recommended installation path is to use virtualenv and pip follow Virtual Environment Installation.
  2. You can now install via setup.py see Global Python Installation.
  3. Alternatively you can install with pip follow Python Package Management Installation.
  4. If you do not have root access or do not want to use pip you can continue to use PYTHONPATH see PYTHONPATH Installation.
  5. For installation on a cluster with multiple Python versions follow Heterogenous Linux Cluster Installation.

Global Python Installation

The Python toolkits are provided as a traditional Python distribution with a setup.py file to install the distribution into the site-packages folder for your Python interpreter. After unpacking the tarball and changing into the resulting directory, do the following the install the distribution:

$ sudo python setup.py install

You can verify that the install worked correctly by starting a python prompt and doing the following:

$ python
Python 2.7.3 (default, Aug  1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> from openeye.oechem import OEChemGetRelease
>>> OEChemGetRelease()
‘2.0.1‘
>>> exit()

The Python toolkit distribution will install all the example programs into a bin directory in your PATH. This allows you to run the oecheminfo.py example to also verify that your distribution is working correctly:

$ oecheminfo.py
Installed OEChem version: 2.0.1 platform: ubuntu-12.04-g++4.6-x64 built: 20140708
...

Python Package Management Installation

The recommended tool for managing Python packages is PIP. The OpenEye Python Toolkit distribution is compatible with pip, the following is equivalent to doing what is described in the above section:

$ sudo pip install OpenEye-python2.7-ubuntu-12.04-x64-2014.6.6.tar.gz

Using PIP for managing your Python packages also allows for packages to be easily uninstalled as well. Uninstalling the package installed above would be the following command:

$ sudo pip uninstall OpenEye-python2.7-ubuntu-12.04-x64-2014.6.6

Note

PIP does not work with older versions of Python, 2.4 and 2.5. easy_install is often available by default with with these versions and can be used like the following:

$ sudo easy_install OpenEye-python2.7-ubuntu-12.04-x64-2014.6.6.tar.gz

Warning

easy_install is officially deprecated and should not be relied upon in the future.

Virtual Environment Installation

Tip

It is considered harmful to install packages into your global python installation, known as site-packages. The recommended way to install any Python packages is using virtual environments.

virtualenv creates safe, isolated python environments in user space, also alleviating the need for root-access to install python packages. virtualenvwrapper offers a shell environment making it easier to work with virtual environments.

Assuming you have virtualenv and virtulenvwrapper installed the following example will create a new virtualenv called oepython and install the OpenEye Python Toolkits into it.

$ mkvirtualenv oepython
(oepython) $ pip install OpenEye-python2.7-ubuntu-12.04-x64-2014.6.6.tar.gz
...
(oepython) $ which oecheminfo.py
~/.virtualenvs/oepython/bin/oecheminfo.py
(oepython) $ deactivate
$

Warning

PYTHONPATH will still override the modules installed into a virtual environment. Make sure PYTHONPATH is not set when using a virtual environment.

PYTHONPATH Installation

If using any of the above techniques are unavailable, the OpenEye Python Toolkits can also be used by pointing the python interpreter at the appropriate directory. Untarring the downloaded distribution tarball will yield a directory structure like the following:

OpenEye-python2.7-ubuntu-14.04-x64-2014.6.6/
   openeye/
      libs/
         python2.7-ubuntu-14.04-x64/
   docexamples/
   examples/

The Python interpreter just needs to know where the openeye directory is, for example, by setting the PYTHONPATH environment variable in your shell startup script ~/.bashrc. The syntax and location may vary if you use a shell other than bash. For example, if you untarred the distribution into /usr/local, the bash syntax would be the following:

PYTHONPATH=/usr/local/OpenEye-python2.7-ubuntu-14.04-x64-2014.6.6
export PYTHONPATH

The equivalent could be done in Python code as well like the following:

import sys
sys.path.append(“/usr/local/OpenEye-python2.7-ubuntu-14.04-x64-2014.6.6“)

If you un-tarred in a different parent directory, you would use that actual location rather than /usr/local.

All the toolkit examples can then be found in the examples directory. From the examples directory on the command line, the examples can be run using a command such as python oechem/oecheminfo.py.

Heterogenous Linux Cluster Installation

On Linux you can untar multiple versions of the toolkit into the same directory, for example RHEL6 Python 2.6 and RHEL7 Python 2.7. When the module is imported the correct version will be selected automatically by the openeye runtime. PYTHONPATH need only be set to point at the top-level openeye directory. For example, installing both the RHEL6 and RHEL7 versions into the same NFS directory named /nfsdir/oepython could be accomplished by doing the following:

$ mkdir /nfsdir/oepython-2014.Jun.6
$ cd /nfsdir/oepython-2014.Jun.6
$ tar –strip-components 1 -vzxf OpenEye-python2.6-redhat-6-x64-2014.6.6.tar.gz OpenEye-python2.6-redhat-6-x64-2014.6.6/openeye/
$ tar –strip-components 1 -vzxf OpenEye-python2.7-redhat-7-x64-2014.6.6.tar.gz OpenEye-python2.7-redhat-7-x64-2014.6.6/openeye/
$ export PYTHONPATH=/nfsdir/oepython-2014.Jun.6

Using the above tar commands also strips out the extraneous files like setup.py and MANIFEST.in. These files are only required by python packaging systems and are not needed when explicitly setting PYTHONPATH.

Integration Testing

The OpenEye Python toolkits ship with a simple set of integration tests to make sure all the libraries are functioning as intended. The test suite is not as exhaustive as the test suite used internally, it is just meant to ensure the OpenEye Python toolkit infrastructure is working as intended. To run the integration test suite, run the following inside an unpacked tarball with the same python interpreter the toolkit were installed into:

$ python setup.py test

A message like the following will be shown if all the tests were run successfully:

test_bfactor2img (tests.test_grapheme.TestGrapheme) ... ok
test_fp2oeb (tests.test_graphsim.TestGraphSim) ... ok
...
test_example1 (tests.test_szybki.TestSzybki) ... ok
test_zap_forces (tests.test_zap.TestZap) ... ok

----------------------------------------------------------------------
Ran 33 tests in 34.004s

OK