Skip to content

Julia in Jupyter

Jupyter allows for language kernels other than Python.

Julia Version

There are multiple versions of Julia installed on Picotte. We will be using julia/1.7.3 in this example.

Prerequisites

VS Code Jupyter setup

This requires that you have VS Code set up to use remote Jupyter kernels. See: Jupyter via VS Code

We will use the following Python version (Jupyter is a Python application; the Jupyter kernel can be other languages):

[juser@picotte001 ~]$ module load python/gcc/3.10

Install IJulia package

This example uses Julia 1.7.3 but will work with any Julia version.

There is only one package to install: IJulia.[1]

In the terminal in VS Code, run Julia and install the IJulia package -- type the "]" (right square bracket) and the prompt will change to the "pkg>" prompt:

[juser@picotte001 ~]$ module load python/gcc/3.10
[juser@picotte001 ~]$ module load julia/1.7.3
[juser@picotte001 ~]$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.7.3 (2022-05-06)
 _/ |__'_|_|_|__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> ]
(@v1.7) pkg> add IJulia
... [lots of output] ...

Hit "Ctrl-D" to exit.

Run Jupyter Lab server and create notebook

At the shell prompt in the same terminal:

[juser@picotte001 ~]$ jupyter-lab
... lots of messages ...
    To access the server, open this file in a browser:
        file:///home/juser/.local/share/jupyter/runtime/jpserver-14571-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/lab?token=random_characters
     or http://127.0.0.1:8888/lab?token=random_characters

Copy one of the URLs shown, and paste into a browser on your PC. You should see a new Jupyter Lab launcher:

756px

Click the "Julia 1.7.3" button to create a new Julia notebook.

756px

The notebook file created resides on Picotte, not on your PC.

Finishing up

When done, from the Jupyter Lab "File" menu, select "Shut Down".

512px

See Also

References

[1] IJulia GitHub repository