Sven Mesecke's blog

Posted Di 20 August 2013

Installing julia for data visualization stuff

Julia is a relatively novel language intended for technical computing, basically a direct contender of MATLAB/Octave, Python/scipy/numpy or R. The crucial difference between Julia and the other languages is its powerful JIT compiler, which is responsible for some impressive benchmark results. I'm exploring Julia as a replacement for MATLAB and will detail my experiences in a sequence of posts.

Julia comes with both a command-line and a web-based REPL, however, they have an ipython port for julia in beta and for this to work we need to use the latest julia build which we'll clone from github:

git clone git://github.com/JuliaLang/julia.git

then run make from the julia directory and add the directory to $PATH. You could now start julia by typing julia in the shell, however, the aim is to use the ijulia environment. For this we'll need to install ipython v1.0, i.e., the latest version. If you follow good advice for python programming, then you will have set up different virtualenvs for different projects (see here here for an overview of using virtualenvs). To avoid having to always activate an environment even when we want to only use julia, we have to install ipython globally:

pip install tornado pyzmq jinja2 pyside ipython

Some other dependencies will be installed alongside ipython. Now we can run julia for the first time by typing julia in the shell. Julia has some potentially ingenious way of managing packages - they simply store them in github repositories. Add julia packages using the Pkg module

Pkg.add("IJulia")

and all dependencies should be automatically downloaded. If something goes wrong (it seems to be still quite work in progress), you might have to remove the package using Pkg.rm("IJulia") or, under special circumstances, remove the whole .julia folder in your $HOME directory, then start all over.

Start ipython - or ijulia - using

ipython notebook --profile julia

if it all works you can add an alias to your .bash_profile

alias ijulia = "ipython notebook --profile julia"

so that the ipython julia notebook runs by typing ijulia.

Julia does not come yet with in-built graphics capabilities, but they are working hard on it and currently provide three different packages: Gaston, a GNUplot wrapper, Winston, a tool that should provide functionality similar to MATLAB and Gadfly, a tool that is intended to be similar to ggplot in R. I only played with Winston and Gadfly. To install Winston I had to add the cairo and pango libraries to my system using

brew tap homebrew/dupes
brew install cairo
brew install pango

and start ijulia to add the needed packages for Winston using

Pkg.add("Cairo")
Pkg.add("Tk")
Pkg.add("Winston")

Gadfly was easier to install, it only needed a straightforward

Pkg.add("Gadfly")

and the dependencies (such as the DataFrames package) were resolved automatically. Now everything should be set up. I explore and compare julia data visualization with MATLAB in the next post.

Any comments/questions? Send me an email.

Category: Scientific Computing
Tags: mac science julia data analysis