Preferred Kernel in jupyter notebook

I have used three different versions of Julia on my PC (1.8.5, 1.9.0, and 1.9.2). For all versions, I’ve already installed the IJulia package or using Pkg and Pkg.build("IJulia"). However, when I use the jupyter notebook, there are just Julia versions 1.8.5 and 1.9.0. is there a limit in the number of Kernel Julia in jupyter notebook?
If not, how could I use all versions of Julia on jupyter notebook?
Thank you all.

There should be no limit on the number of kernels.

What might cause the problem is that the default name for the kernel spec is julia-1.X for each minor version, so probably one kernel spec got overridden when you installed the second 1.9 kernel.

You can manually install another kernel with installkernel (also useful if you want to have a different kernel with multithreading etc.)

using IJulia

# Let's say this is in the 1.9.0 environment
installkernel("Julia-legacy")

and then install the latest version normally with pkg> build. Here is more info
https://julialang.github.io/IJulia.jl/dev/manual/installation/#Installing-additional-Julia-kernels

You can also check if the kernels are pointing to the correct locations of the Julia executable by inspecting the paths returned from

shell> jupyter kernelspec list

In the folder corresponding to the listed kernel spec, there should be a kernel.json which contains the path to the Julia executable.

PS: IJulia (or jupyter?) seems to always append the full version number to the kernel name displayed in Jupyter (at least Jupyter lab). Not a problem, but it looks a bit silly if the name is Julia 1.9.0 1.9.0, so I chose a different name in the example :sweat_smile:

I tried to use installkernel to create a new kernel from the REPL of Julia version 1.9.2, but the result has a path as follows:

jupyter\\kernels\\julia-1.9.2-1.9

julia-1.9.2 is the name of the kernel that I intend to create and - 1.9 is the version of the kernel. I am not sure whether there are the correct versions for the kernel I want to create or not. Because if I tried to create two new kernels with names 1.9.2 and 1.9.0 both of them have the same extension -1.9 at the end of the path.

As long as the name is different (julia-1.9.2-1.9 and julia-1.9.0-1.9 or just julia-1.9) everything should work.

If you want to be absolutely sure, you can run versioninfo() in a Jupyter notebook with the two different kernels and check what their versions are.

Thank you for your help.

1 Like

I’m glad it’s working!

Jupyter can be a bit fickle sometimes :grin:

1 Like