This is a short note on how to swiftly update Julia and IJulia (the kernel to work with Jupyter notebooks) when a new minor version is released. The following instructions are for Linux, with the example of upgrading from version 1.1 to version 1.2.
(remark: the existing StackOverflow question “How to upgrade Julia to a new release?” is very outdated, as of September 2019, and doesn’t cover Jupyter kernels)
Step 1: dowload
Download the latest binary release: https://julialang.org/downloads/ and unpack it. For me: ~/Programmes/others/julia-1.2.0
Step 2: update $PATH
Update path to the Julia binary which is prepended to the $PATH
variable in the ~/.bashrc
file:
export PATH="/home/pierre/Programmes/others/julia-1.2.0/bin:$PATH"
Test in the shell command line: the julia
command should now launch the new Julia REPL (at least after a shell restart).
Step 3: reinstall (and update) packages
Objective here is to reuse all the previously installed packages without the need to remember their names.
In the ~/.julia/environments
directory, copy the Project.toml
file from the previous version directory (ex: v1.1
) and paste it in a directory named as the new version (ex: v1.2
).
Now, in the Julia REPL, enter the Pkg REPL (pressing ]
) and run update
. If there is no new package version, there is no actual download happening. However, compiled packages like IJulia
should be rebuilt.
Test: assuming that the IJulia
packaged was included in Project.toml
, the new Julia version should be available as a Jupyter kernel in the lab/notebook interface.
Remark: during my 1.4→ 1.6 update, the new kernelspec was not installed, so that I could not launch Julia 1.6 notebook. Perhaps there is no more automatic rebuilding of IJulia
. So I forced the rebuild (in REPL: ]build IJulia
).
Step 4: clean up the old Jupyter kernel
In the ~/.local/share/jupyter/kernels
directory, there should be at least two directories: the one for the old Jupyter kernel (ex: julia-1.1
) and the one for the new kernel (ex: julia-1.2
). If the old kernel is not needed, it can be removed.
Notice: the kernel directories can be found with the $jupyter kernelspec list
command.
(The directory of the old Julia binary can be deleted as well.)