Change default IJulia kernel associated to a notebook

Hi there

I cloned the git repo rethinking.jl for the Statistical Rethinking, 2nd. ed. book, in order to follow along with its notebooks. My currrent version of Julia is 1.8.3, but I still have older ones (such as 1.6.2, for instance). My problem is when I issue:

julia> using IJulia; notebook(detached=true)

and then select one of the notebooks from the cloned repo, it is automatiicaly opened with the 1.6.2 kernel, instead of the 1.8.3 I would like. Is there a way to tell IJulia (for good) to open it (and any other notebooks, for that matter) always with the newest available kernel? I thought I might achieve this by editing either the Project.toml or Manifest.Toml files, but the ones downloaded did not seem to have any direct reference to the Julia version…

Thanks in advance

PS: in hindsight, I thought of deleting the .toml files from the cloned repo, running the commands generate and activate, and then adding all the used packages from scratch, but there should be a more direct way…

1 Like

The kernel name is stored in the notebook file itself. Opening the notebook, switching kernels, and saving should be sufficient.

(If you open the notebook in a text editor you should be able to easily see where the kernel info is stored. The JSON format is human readable.)

1 Like

@stevengj I followed your suggestion and it seems to have worked. Thank you!

Just for future reference, I would like to add some more specific piece of information:

  • I checked what were the jupyter kernels I had installed, via the command
jupyter kernelspec list
  • then, as suggested by @stevengj, I checked that, in my concrete notebook, the relevant data were at its end (as opened via a usual text editor, e.g., emacs) and I changed all occurrences of 1.6.2 to 1.8.3 so as they now read:
"metadata": {
  "kernelspec": {
   "display_name": "Julia 1.8.3",
   "language": "julia",
   "name": "julia-1.8"
  "language_info": {
   "file_extension": ".jl",
   "mimetype": "application/julia",
   "name": "julia",
   "version": "1.8.3"