Wednesday, June 19, 2013

Setting up Julia

Julia is a promising new language for statistical computing. However, it's still in a relatively early stage of development. In particular, the package manager is prone to breaking, and I've had some problems getting it working smoothly, as it (currently) doesn't seem possible to remove packages. This is a problem, as if an installation doesn't work, then you can't add any more packages. While this problem will eventually be resolved, this is my setup for now, which should work on Linux and Mac OSX.

  1. I built the latest Julia from the git repository.

cd ~/Programs
git clone https://github.com/JuliaLang/julia.git
cd julia
make
  1. I added the julia build directory to my path.

export PATH=$PATH:~/Programs/julia/usr/bin

I can then launch julia as follows.


julia-release-readline

Recent builds of ESS in Emacs have some support for Julia; you'll need to add the julia binary to your .emacs file.


(load "/home/simon/Programs/ESS/lisp/ess-site") ;; or wherever ESS lives
(setq inferior-julia-program-name "/home/simon/Programs/julia/usr/bin/julia-release-basic")

Now typing M-x julia will start a Julia REPL, you can open up a Julia .jl script, and send lines or regions to the buffer.

  1. I added the following packages.


Pkg.add("DataFrames")
Pkg.add("Distributions")
Pkg.add("Winston")

When installing Winston, I've found that on OSX, installation of dependencies is best done from source; using the brew option broke the installation, and hence blocked me from adding new packages. Also, Julia has problems finding libcairo and fontconfig that I've installed using Homebrew, so these need to be added to the library path. On my machine:


export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Cellar/Cairo/1.12.2/lib:/usr/local/Cellar/fontconfig/2.10.93/lib

You'll have to change the versions according to your setup.


No comments: