juliaup
The best way to install julia (allows for multiple installed versions and will always alert to new releases) is via the instructions at juliaup - please follow those for your OS.
you can equally well download the current release for your OS from here
After installing, make sure that you can run Julia. If you installed via juliaup
, you should be able to start julia from your command line now by typing julia
and hitting enter. Otherwise just launch the julia app from your Applications folder.
Make sure that you are able to launch Julia and calculate 1+1
before proceeding!
Pluto
Next we will install the Pluto notebook 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:
julia> ]
(@v1.10) pkg>
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:
(@v1.10) 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.
We need a modern browser to view Pluto notebooks with. Firefox and Chrome work best.
Repeat the following steps whenever you want to work on a project or homework assignment.
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 sample notebooks. Samples 1, 2 and 6 may be 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!
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. Copy this link (right click -> Copy 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.
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.
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\\fonsi\\Documents\\18S191_assignments\\
on Windows
/Users/fonsi/Documents/18S191_assignments/
on MacOS
/home/fonsi/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.
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.