AERE504: Julia

Fall Semester 2019

Julia

We will use Julia to demonstrate various algorithms. Julia is a high-level language for scientific computing that provides exceptional run-time performance, approaching that of statically-compiled languages like C. The software is free and open source and is under active development. Julia is considered being able to solve the “Two Language” problem.

If you are familiar with MATLAB, R, or Python, see this list of notable differences.

There are many ways to get going with Julia. Here are some options:

  • Install Julia on your own machine. You can download and install the command line version or a version that is bundled with the Juno IDE.

  • Run Julia in the cloud on JuliaBox. You will want to make sure to back up your code to a CyBox folder, Google Drive folder, or a Git repository to reduce the risk of losing your work. Also, be sure not to exceed 500MB, otherwise your older files will be lost. Note: Please be sure you are using Julia version 0.5.3 or 0.5.2.

Local Installation

To install the course software on your local machine, complete the steps outlined in this section on this page. Or follow complete installation instructions below:

Note: throughout this section, lines beginning with julia> should be run in the Julia REPL.

Note: if anything goes wrong, see Troubleshooting section below on this page.

  1. Install Julia 0.5: Instructions

  2. To install Jupyter, start Julia and run julia> Pkg.add(“IJulia”)

  3. Install the course code: download and unzip the aere504-notebook directory: aere504-notebook-archive.zip

    1. In Julia, run the install script to install all dependencies, replacing $PATH_TO_AERE504_NOTEBOOK with the path to the aere504-notebook directory: julia> include(“$PATH_TO_AERE504_NOTEBOOK/install.jl”)

    2. Run jupyter in the aere504-notebook directory julia> using IJulia julia> notebook(dir=“$PATH_TO_AERE504_NOTEBOOK”)

Troubleshooting

Fixes for things that might go wrong.

Problems installing jupyter

To test the installation, in Julia, run

julia> using IJulia
julia> notebook()

This should open a jupyter notebook browser in the current directory. If this doesn't work, jupyter may not be installed correctly.

HDF5 build error when installing BayesNets.jl from install.jl

HDF5 is a data storage library (the same that is used in Matlab’s .mat files). Julia should automatically download and install the library, but you may need to do it manually. More instructions are at the HDF5.jl repo - Ubuntu: sudo apt-get install hdf5-tools

Bayesian network graph visualizations do not display correctly in notebooks

  • If text is displayed without an image: TikzGraphs.jl or one of its dependencies may not be installed correctly. Try reinstalling it.

  • If only edges are displayed or node labels do not display correctly: Use the google-chrome browser. Firefox and other browsers may not display the svgs correctly.

PGFPlots/SVG conversion errors when running notebooks

If you get an error similar to

Error saving as SVG
could not spawn `pdf2svg tikzpicture.pdf tikzpicture.svg`: no such file or directory (ENOENT)

You need to have pdf2svg installed on your machine. If on OSX, run:

brew install pdf2svg

Please install homebrew here if you do not have it yet. If you do not have xcode tools installed, refer to this.

If on Ubuntu, run:

sudo apt-get install pdf2svg

If on Windows, dowload this: https://github.com/jalios/pdf2svg-windows/archive/master.zip. Extract the zip file where you want to keep it. Then add the directory inside called “dist-64bits” to your path. Instructions on how to do this can be found here.

And make sure that you add pdf2svg to your path, regardless of your platform, so that you can run “pdf2svg” from the terminal.