Installing and running khmer

You’ll need Python 2.7+ and internet access.

The khmer project currently works with Python 2.6 but we target Python 2.7+.

Build requirements


If you just want to use the khmer project tools and not develop them then skip to step 4.

  1. Install Xcode from the Mac App Store (requires root).

  2. Register as an Apple Developer.

  3. Install the Xcode command-line tools: Xcode -> preferences -> Downloads -> Command Line Tools (requires root).

  4. From a terminal download the virtualenv package and create a virtual environment with it. You’ll need the URL of the latest virtualenv release.

    curl -O
    tar xzf virtualenv*
    cd virtualenv-*; python2.7 ../khmerEnv; cd ..
    source khmerEnv/bin/activate


  1. Install the python development environment, virtualenv, pip, and gcc.

    • On recent Debian and Ubuntu this can be done with:

      sudo apt-get install python2.7-dev python-virtualenv python-pip gcc
    • For RHEL6:

      sudo yum install -y python-devel python-pip git gcc gcc-c++ make
      sudo pip install virtualenv
  2. Create a virtualenv and activate it:

    cd a/writeable/directory/
    python2.7 -m virtualenv khmerEnv
    source khmerEnv/bin/activate

    Linux users without root access can try step 4 from the OS X instructions above.

Latest stable release

  1. Use pip to download, build, and install khmer and its dependencies:

    pip2 install khmer
  2. The scripts are now in the env/bin directory and ready for your use. You can directly use them by name, see khmer’s command-line interface.

  3. When returning to khmer after installing it you will need to reactivate the virtualenv first:

    source khmerEnv/bin/activate

Latest development branch

Repeat the above but modify the pip install line:

pip2 install git+

You can change master in the above command to the name of another branch.

Run the tests

If you’re running a version of pip less than 1.4 and you want to run the tests then you should upgrade pip:

pip2 install --user --upgrade pip

Repeat the appropriate installation procedure from above but add “–no-clean” to the pip invocation.

The source will be in the khmerEnv/build/khmer directory. Run make test there.

comments powered by Disqus

Table Of Contents

Previous topic

Introduction to khmer

Next topic

A few examples

This Page