Table of Contents
This is an intensive workshop for the Julia language, composed out of three 2-hour segments. It targets people already familiar with programming, so that the established basics such as for-loops are skipped through quickly and efficiently. Nevertheless, it assumes only rudimentary programming familiarity and does explain concepts that go beyond the basics. The goal of the workshop is to take you from zero to hero (regarding Julia): even if you know nothing about Julia, by the end you should be able to use it like a pro.
The material has been updated during July-December 2023 to Julia v1.9+ and corresponding latest stable versions of used packages
This workshop is also available on YouTube: https://www.youtube.com/watch?v=Fi7Pf2NveH0 in its original form, however the current notebook versions are significantly more streamlined and of higher educational quality!
Installing Julia and the environment you want to program Julia in is NOT part of this workshop! There are many options, up to preference, and may even depend on your operating system. And some options may be impossible depending on your environment, who knows! Essentially what you want to achieve is run Julia within a Jupyter environment, and how to do this is up to you.
This section outlines our recommendation on how to run Julia+Jupyter and run the notebooks of this workshop. Our recommendations have high robustness and usability, however, there is no guarantee that these recommendations will work for your setup! If anything fails, troubleshoot using the official channel for seeking support for the Julia language (https://julialang.org/about/help/).
This contains the Jupyter notebooks that we will use for the tutorials, the exercise solutions, and the installation script.
We recommend the juliaup command line tool for installing and managing Julia, but you can use whatever means you want. The same tool is recommended by the official Julia website, however if something goes wrong you should visit the Julia installation page for alternatives: https://julialang.org/install/.
After installing Julia, make sure the installation was successful by launching it.
This will open the REPL (read-evaluate-print-loop) environment, essentially an interactive window with black background where you can immediately running Julia in.
Type a dummy command like x = 5 + 2 and make sure it evaluates.
Once again, how to achieve this is up to you, and here we provide two possibilities. If both fail, you need to troubleshoot your problem using the web.
Regardless of the method you chose, test that your installation worked by creating a new Jupyter notebook.
- Install VSCode. We recommend VSCode as the environment to code and run Julia in, because it has an integrated text editor and a REPL console, it can run Jupyter notebooks out of the box, and has high quality debugging tooling.
- Install the Julia for VSCode extension. To do this, open VSCode, go to Extensions, search for
Juliaand install. Once this is done, you should be able to run Julia within VSCode without any further configuration. Examples of what is possible:- A console for Julia which you can get by typing
Alt+J, Alt+Oin VSCode. - Using Julia in a scripting environment in VSCode. When working on a Julia script (a
.jltext file) you may evaluate any amount of code in the script interactively. E.g.,Ctrl+Enterevaluates current line being edited. The Julia process that evaluates the script is the same as the one in the console you get in point 1. The Julia console and the text editor window are linked! - You can open Jupyter notebooks without installing anything else. Simply drag+drop the notebook into VSCode and it will request a "kernel" (choose Julia). Or, you can create new Jupyter notebooks by pressing
Ctrl+Shift+Pinside VSCode and then typingCreate: New Jupyter Notebook. Each Jupyter notebook launches a dedicated Julia process, so the Jupyter notebooks are not linked with the standard text editor and Julia console of VSCode!
- A console for Julia which you can get by typing
If the above doesn't work for you, a robust alternative is to use the IJulia package.
Open the Julia REPL again (Step 1), and then input the following 4 commands:
import Pkg
Pkg.add("IJulia")
import IJulia
IJulia.notebook()this will install the IJulia package, an independent and minimal Jupyter environment, compile both, and then launch a Jupyter server into your browser.
There you can create new or open existing Jupyter notebooks.
Depending on your internet connection and your machine, the speed that the Julia packages we use will be downloaded, installed, and compiled, can take up to several minutes. Hence, it is good to do it before the workshop. To install everything run the install_and_compile.jl Julia script that is in this repo that you clone.
Julia is a relatively new programming language, developed at MIT, with version 1.0 released in August 2018. It was developed particularly targeting scientific computing applications. Even though it is so recent, it has taken the scientific community by storm and many large scale projects have started using Julia.
The Julia documentation outlines the main facts and features of Julia.
I've put my thoughts on how to answer this question in Why Julia - a Manifesto.
Much of the material of this workshop is created by the author (George Datseris). However significant content comes from the following sources:
- The JuliaBox tutorials for the core language
- Exercises from exercism.io
- Chris Rackauckas' tutorials from http://ucidatascienceinitiative.github.io/IntroToJulia/
- Carsten Bauer's workshop https://github.com/crstnbr/JuliaWorkshop19
- Stefan Karpinski's JuliaCon talk, "The Unreasonable Effectiveness of Multiple Dispatch"
- Jonas Isensee's DrWatson talk at Julia users meetup (in UK, hosted by Invenia)
- https://github.com/mitmath/18330
- Kristoffer Carlsson and Fredrik Bagge Carlson's talk "Julia for AI and Data Science" https://www.youtube.com/watch?v=2MBD10lqWp8
