6.3 Installing Drake
Drake has quite a few dependencies, which makes its installation process rather involved. For the following instructions we assume that you are on Ubuntu.
If you’re using the Data Science Toolbox, then you already have Drake installed, and you may safely skip this section.
Drake is written in the programming language Clojure which means that it runs on the Java Virtual Machine (JVM). There are pre-built jars available but because Drake is in active development, we will build it from source. For this, you will need to install Leiningen.
$ sudo apt-get install openjdk-6-jdk
$ sudo apt-get install leiningen
Then, clone the Drake repository from Factual:
$ git clone https://github.com/Factual/drake.git
And build the uberjar using Leiningen:
$ cd drake
$ lein uberjar
This creates drake.jar. Copy this file to a directory which is on your $PATH, for example, ~/.bin:
$ mv drake.jar ~/bin/
At this point you should already be able to run Drake:
$ cd ~/bin/
$ java -jar drake.jar
This is not really convenient for two reasons: (1) the Java Virtual Machine (JVM) takes a long time to start and (2) you can only run it from that directory. We advise you to install Drip, which is a launcher for the JVM that provides much faster startup times than the java
command. First, clone the Drip repository from Flatland:
$ git clone https://github.com/flatland/drip.git
$ cd drip
$ make prefix=~/bin install
Then, create a Bash script that allows you to run Drake from everywhere:
$ cd ~/bin
$ cat << 'EOF' > drake
> #!/bin/bash
> drip -cp $(dirname $0)/drake.jar drake.core "$@"
> EOF
$ chmod +x drake
To verify that you have correctly installed both Drake and Drip, you can run the following command, preferably from a different directory:
$ drake --version
Drake Version 0.1.6
Drip speeds up Java because it reserves an instance of the JVM, after it has been run once. Because of this, you will only notice the speed up from the second time onwards.