Installation
On the lab computers
Easiest is to watch this video, courtesy of your wonderful TA: Enrico Caprioglio!
But if you prefer written instructions…
- Open software hub
- Open Julia within the software hub
- Run the following command
]add Pluto
- press the return key to run the command, and then the backspace key to exit the package manager):
using Pluto; Pluto.run()
After a pause of a minute, a new window should open on your internet browser saying Welcome to Pluto
.
Now download the appropriate notebook: go to the notebooks, week 1 section of this website. Open the
questions
tab. Clickedit or run this notebook
on the top right. This gives you the option of downloading the notebook as a .jl file.Open your downloads folder. Drag the notebook.jl file that you downloaded onto your
Welcome to Pluto
page. That should open the notebook!
First-time setup on personal computer
- These installation instructions are copied fairly directly from the similarly structured MIT course. Thanks for doing my work for me!
\ \ \ Text and pictures version:
Step 1: Install Julia 1.9.3
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 Pluto
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 julia>
prompt:
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:
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
julia> Pluto.run()
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. Assignments will be provided in the form of notebooks: see menu bar at top right. To start from a template notebook on the web, you can paste the URL into the blue box and press ENTER.
For example, the first Week 1 notebook 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:
C:\\Users\\fons\\Documents\\18S191_assignments\\
on Windows/Users/fons/Documents/18S191_assignments/
on MacOS/home/fons/Documents/18S191_assignments/
on Ubuntu
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:
Click Choose.
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.