First-time setup: Install Julia & Pluto
Text and pictures version:
Step 1: Install Julia
Go to https://julialang.org/downloads and download the current stable release, Julia
Step 2: Run Julia
After installing, make sure that you can run Julia. On some systems, this means searching for the “Julia
julia in a terminal. Make sure that you can execute
1 + 1:
Make sure that you are able to launch Julia and calculate
1+1 before proceeding!
Step 3: Install
Next we will install the Pluto, the notebook environment that we will be using during the course. Pluto is a Julia programming environment designed for interactivity and quick experiments.
Open the Julia REPL. This is the command-line interface to Julia, similar to the previous screenshot.
Here you type Julia commands, and when you press ENTER, it runs, and you see the result.
To install Pluto, we want to run a package manager command. To switch from Julia mode to Pkg mode, type
] (closing square bracket) at the
The line turns blue and the prompt changes to
pkg>, telling you that you are now in package manager mode. This mode allows you to do operations on packages (also called libraries).
To install Pluto, run the following (case sensitive) command to add (install) the package to your system by downloading it from the internet. You should only need to do this once for each installation of Julia:
1.8) pkg> add Pluto
This might take a couple of minutes, so you can go get yourself a cup of tea!
You can now close the terminal.
Step 4: Use a modern browser: Mozilla Firefox or Google Chrome
We need a modern browser to view Pluto notebooks with. Firefox and Chrome work best.
Second time: Running Pluto & opening a notebook
Repeat the following steps whenever you want to work on a project or homework assignment.
Step 1: Start Pluto
Start the Julia REPL, like you did during the setup. In the REPL, type:
julia> using Pluto
The terminal tells us to go to
http://localhost:1234/ (or a similar URL). Let’s open Firefox or Chrome and type that into the address bar.
If you’re curious about what a Pluto notebook looks like, have a look at the Featured Notebooks. These notebooks are useful for learning some basics of Julia programming.
If you want to hear the story behind Pluto, have a look a the JuliaCon presentation.
If nothing happens in the browser the first time, close Julia and try again. And please let us know!
Step 2a: Opening a notebook from the web
This is the main menu - here you can create new notebooks, or open existing ones. Our homework assignments will always be based on a template notebook, available in this GitHub repository. To start from a template notebook on the web, you can paste the URL into the blue box and press ENTER.
For example, homework 0 is available here. Go to this page, and on the top right, click on the button that says “Edit or run this notebook”. From these instructions, copy the notebook link, and paste it into the box. Press ENTER, and select OK in the confirmation box.
The first thing we will want to do is to save the notebook somewhere on our own computer; see below.
Step 2b: Opening an existing notebook file
When you launch Pluto for the second time, your recent notebooks will appear in the main menu. You can click on them to continue where you left off.
If you want to run a local notebook file that you have not opened before, then you need to enter its full path into the blue box in the main menu. More on finding full paths in step 3.
Step 3: Saving a notebook
We first need a folder to save our homework in. Open your file explorer and create one.
Next, we need to know the absolute path of that folder. Here’s how you do that in Windows, MacOS and Ubuntu.
For example, you might have:
Now that we know the absolute path, go back to your Pluto notebook, and at the top of the page, click on “Save notebook…”.
This is where you type the new path+filename for your notebook:
Step 4: Sharing a notebook
After working on your notebook (your code is autosaved when you run it), you will find your notebook file in the folder we created in step 3. This the file that you can share with others, or submit as your homework assignment to Canvas.