Link Search Menu Expand Document

Lab 0: Introduction to Julia & Pluto


You will keep an electronic lab notebook this semester using the programming language Julia and a notebook extension for it called Pluto. This exercise will help you get those tools running and learn the basics of using them so that your work goes more smoothly during Lab 1.

Objective: Become familiar with Markdown, Julia, and Pluto

Turn in: Your 2 completed Pluto notebooks with no errors (submit 2 .jl files and 2 .html files).

Student Learning Outcomes:

  • Become familiar with Markdown syntax.
  • Become familiar with Pluto and Julia.
  • Understand how to access lab notebook templates in Pluto.
Table of Contents
  1. Option 1: Use Julia and Pluto on VCAT
    1. Sign in to VCAT
    2. Launch Julia and Pluto
  2. Option 2: Install on your own computer
    1. Install Julia and Pluto
    2. Launch Julia & Pluto
  3. Assignment

Option 1: Use Julia and Pluto on VCAT

Choose ONE of the options to access Julia and Pluto. If you’re unsure, start with Option 1 for now. You can always switch to the option 2 later!

The officially supported method of using Julia is through STEM VCAT using the VM Ware Horizon Client. This does not require you to install Julia, but your may need to install the VMWare Horizon client (ask IT for help if you have trouble accessing VCAT).

Pros of using VCAT:

  • Software is installed and managed for you.
  • Runs on a WCU computer, which may be faster than your computer – Julia can require a lot of resources.

Cons of using VCAT:

  • Working with files on VCAT with Julia can be more difficult that working with them on your own computer.
  • VCAT deletes your files when you exit, so you have to be careful with saving them.
  • VCAT requires an internet connection. VCAT will not work in areas with no internet or slow internet VCAT.

Sign in to VCAT

  1. Go to vcat.wcu.edu.
  2. Sign in using your WCU ID and password (if you’re not already signed in).
  3. Make sure you are in the “Bookmarks” tab at the top of the page.
  4. Click the three dots in the upper right corner of the STEM Specialized machine, and choose Launch in Client.

    If you do not see STEM VCAT in your Bookmarks, go to the Catalog tab, add STEM VCAT as a bookmark, and then go back to Bookmarks to open it.
  5. Choose the STEM Specialized machine.

A screenshot showing the VCAT start page with STEM VCAT highlighted

Launch Julia and Pluto

  1. Click on the JuliaPortable icon to open the Julia REPL (read-evaluate-print-loop). You will be asked to enter your username and password.

    A screenshot showing the JuliaPortable icon and Julia REPL

  2. Type using Pluto; Pluto.run() into the Julia REPL and then press the Enter key.

    If Pluto doesn't open automatically or you would like to use a different browser other than your default, copy and paste the link from the Julia REPL into your browser URL bar. The link will look like 'localhost:1234/?secret=...'.
    You MUST use Google Chrome or Firefox to run Pluto! Using another browser will cause your work to save incorrectly!

    The Julia REPL showing the text to type to start Pluto

  3. If successful, you should see the screen below!

    A screenshot showing the Pluto interface and Julia REPL running the background

Option 2: Install on your own computer

Choose ONE of the options to access Julia and Pluto. If you’re unsure, start with Option 1 for now. You can always switch to the advanced option later!

You may find it’s more convenient to install Julia and Pluto on your personal computer. The software is free and open-source, however I cannot guarantee support for issues you run into during installation.

Pros of installing on your computer:

  • You can store files wherever you want and not have them getting deleted daily (although, you should back up your files to another location just in case!)
  • Runs directly on your computer, which may be easier than going through the VMWare Horizon intermediary app.
  • Does not require internet (after initial setup)

Cons of using Julia on your computer:

  • You have to install and maintain the software. This process has gotten to the point where it works pretty well, but problems occasionally arise and you will have to fix them. You also accept any risk associated with installing software from the internet.
  • Julia can run excrutiatingly slow if your computer is old or not very powerful.

Install Julia and Pluto

  1. Install Julia by going to julialang.org, download the version appropriate for your system, and follow the instructions in the installer.

The video below shows the steps to install Julia and Pluto. You may also view the video on Panopto if you have trouble with the embedded version below.

Launch Julia & Pluto

  1. The way you launch Julia will depend on your operating system. You will see a window like the image below, which is called the REPL (read-evaluate-print loop).

    • Windows: Search for Julia using Windows search.
    • Mac OSX: Look for Julia in your Applications folder or search for Julia using Spotlight (Cmd + Space on Mac brings up Spotlight).

      If this is the first time you've run Julia on your Mac you may have to right click (or CTRL + click) on Julia in your Applications folder, choose Open, and give Julia permission to run on your machine.
    • Ubuntu Linux: Open the terminal and type julia. (May require you to set a symlink.)

    A screenshot showing the Julia REPL window

  2. If you haven’t yet installed the Pluto package, you need to use Julia’s package manager to install it. While in the Julia window, press ] on your keyboard to enter the package manager mode, then type add Pluto and hit the Enter key. It will look something like below (you will enter everything after the ‘>’ symbols).

     julia> ]
     pkg> add Pluto
    
  3. Once Pluto is installed, you can exit Pkg by pressing the backspace key.

  4. Open Pluto by typing the following commands into the Julia prompt and then hitting the Enter key.

        import Pluto; Pluto.run()
    

    A screenshot showing the Julia REPL window with the command to open Pluto entered, import Pluto; Pluto.run()

  5. Pluto should open in your default web browser (it requires Firefox, Chrome, or another Chromium-based browser to run properly).

    If Pluto doesn't open automatically or you would like to use a different browser other than your default, copy and paste the link from the Julia REPL into your browser URL bar. The link will look like 'localhost:1234/?secret=...'.
    You MUST use Google Chrome or Firefox to run Pluto! Using another browser will cause your work to save incorrectly!

    A screenshot showing the Pluto welcome page in the Firefox web browser

Assignment

There are two exercises you need to complete, 0A and 0B.

  1. For each exercise, copy the link below by using Right Click > Copy Link [Address/Location].

  2. Paste the link into the ‘Open from file:’ box in Pluto and click Open.

    A screenshot showing the box to paste a URL into when opening from GitHub

  3. Complete the steps/follow the instructions in the Pluto template.

  4. Turn in your work on Canvas:

    1. Save your work as a .jl file

      A screenshot showing how to save a .jl file in Pluto

    2. Save your work as a static .html file

      A screenshot showing how to save a .html file in Pluto

    3. Upload to Canvas!

      A screenshot showing how to upload files to Canvas