Use Julia from Jupyter notebook

Related: Install Julia IDE: Juno


IJulia allows running Julia from within the web browser-based Jupyter IDE.

Install

In general (for all operating systems) it’s recommended to install and update Julia via the downloads from Julia website.

Install Jupyter

Locate Jupyter binary location

  • Windows: where jupyter
  • Linux, MacOS: which jupyter

If Jupyter is not installed, just do

conda install jupyter

Install IJulia

Start Julia with this environment variable (only necessary once)

  • Linux / MacOS:

    JUPYTER=$(which jupyter) julia
  • Windows: “C:\miniconda3\scripts\jupyter.exe” is from where jupyter

    set JUPYTER=C:\miniconda3\scripts\jupyter.exe
    
    julia

Finally, type at Julia prompt:

using Pkg

Pkg.add("IJulia")

This installs numerous packages via conda automatically.

Usage

Existing .jl files are NOT runnable from IJulia.

  1. start the Notebook by EITHER:

    • Terminal/Command Prompt: jupyter notebook
    • Julia: using IJulia; notebook()
  2. Create an interactive Julia .ipynb Julia notebook by clicking New → Julia.

Notes