Installing PyMOL and cctbx
Queen's University Protein Function Discovery
and Department of Biomedical and Molecular Sciences
Molecular Modelling and Crystallographic Computing Facility
Crystallography and Modelling:

Installing PyMOL and cctbx

Getting PyMOL to play nicely with cctbx can sometimes be a chore. In order to get the two projects to use the same version of python, you need to install both of them from source.

I install cctbx from source, although you could use one of the self-extracting binary distributions:

CCTBX installation instructions

  1. Download the self-extracting source from the cctbx downloads page
  2. put the file self_bundle.selfx in new directory, e.g. /usr/local/cctbx, and then
  3. run the command perl self_bundle.selfx
  4. Note the creation of the file: cctbx_build/ and cctbx_build/setpath.csh. You will need to run one of these, depending on whether you use a bash-like or csh-like shell, to allow subsequent python commands to see the newly installed cctbx modules.
  5. In the cctbx_build/bin directory there is a cctbx.python file. Make sure there is a symbolic link to that called python. I.e.
      ln -s cctbx.python python
    Once the cctbx setup script is run, this directory will be in your PATH and it will run your system python, but it will also set up up the necessary environment for cctbx.
I personally use PyMOL installed from the SVN source to have the latest and greatest features.

PyMOL installation instructions

  1. Download (or update) PyMOL via SVN. I use a little script that looks like this:
      #! /bin/sh
      usage() {
        echo -e "\ [options]"
        echo      "where [options] could be:"
        echo      "     --backup|--back   Make backup copy"
      svnbackup() {
        echo "Making backup copy (in case something goes wrong ...)"
        cd pymol && tar cf - . | ( cd ../old_pymol && tar xf - )
        cd ../
      svnupdate () {
        svn checkout pymol
      if [[ "$#argv" < 1 ]] ; then
        if [[ "$1" == "-h" || "$1" == "--help" ]]; then
      # don't do backup unless "back" flag is given
        elif [[ "$1" == "--back" || "$1" == "--backup" ]]; then
    This will download the pymol source into the "pymol" directory.
  2. Now you just need to run a few commands:
      python build
      python install
      python install
    Optionally, you can specify an installation location with the "prefix" option to the install command. For example, I store all of our software on an NFS accessible disk that is mounted as "/software" and the python libraries for our Linux computers are installed in /software/Linux/lib/python2.6/site-packages so I do this as:
      python install prefix=/software/Linux
  3. I modify the pymol script that starts pymol, so that it looks like this:
      PYTHON_VERSION=`python -V 2>&1 | awk '{print $2}' |cut -c 1-3`
      if [ -e /software/Linux/lib/python${PYTHON_VERSION} ]; then
        python /software/Linux/lib/python${PYTHON_VERSION}/site-packages/pymol/ $*
        python2.5 /software/Linux/lib/python2.5/site-packages/pymol/ $*
After installing these and sourcing the setpaths.(c)sh script for cctbx, executing the pymol command should start a version of PyMOL that can use the cctbx modules.