Jupyter kernel not found when rendering with Quarto

I am trying to use Quarto to render the following known example file (ex2_Julia.qmd):

---
title: "Plots Demo"
author: "Norah Jones"
date: "5/22/2021"
format:
  html:
    code-fold: true
jupyter: julia-1.8.0
---

## Parametric Plots

Plot function pair (x(u), y(u)).
See @fig-parametric for an example.

```{julia}
#| label: fig-parametric
#| fig-cap: "Parametric Plots"

using Plots

plot(sin,
     x->sin(2x),
     0,
     2π,
     leg=false,
     fill=(0,:lavender))

I have no problems when using the Python version, but when I do the following command on the terminal (Mac), I get an error:

❯ quarto render ex2_julia.qmd
ERROR: Jupyter kernel 'julia-1.8.0' not found.

I don’t understand why the kernel is not found. I added IJulia.

1 Like

What is the output of jupyter kernelspec list?

When you installed IJulia did you modify ENV["PYTHON"] to work in the same Python environment as Quarto?

See GitHub - JuliaPy/PyCall.jl: Package to call Python functions from the Julia language

Did you try julia-1.8

2 Likes

You’re right:

Available kernels:
  ir           /Users/sergiobacelar/Library/Jupyter/kernels/ir
  julia-1.6    /Users/sergiobacelar/Library/Jupyter/kernels/julia-1.6
  julia-1.7    /Users/sergiobacelar/Library/Jupyter/kernels/julia-1.7
  python3      /Users/sergiobacelar/Library/Jupyter/kernels/python3
  octave       /Users/sergiobacelar/anaconda3/share/jupyter/kernels/octave

There is no julia-1.8.0 kernel. How can I modify the ENV? I am using Anaconda and I have a base env. I tried conda deactivate but I think it didn’t work.

Yes. Same error.

In Julia REPL (plz make sure you are running Julia 1.8)

using Pkg
Pkg.build("IJulia")

This command should register the julia-1.8 kernel.

Just to be sure, you can run jupyter kernelspec list to see if julia-1.8 kernel is installed.

Edit: And as @mkitti suggested, please make sure IJulia is using the same python environment as quarto is.

4 Likes

Try this in julia.

ENV["PYTHON"] = "/path/to/python/used/by/quarto"
using Pkg
pkg"add PyCall"
pkg"build PyCall"
pkg"add IJulia"
pkg"build IJulia"

You can determine the path to quarto’s Python using which python.

4 Likes

I think I found the solution:
build IJulia

3 Likes

I see that build fixed your issue, but I wanted to put this here in case somebody else has a slightly different issue. I had a weird case were Quarto was picking up a different python version than what was on my path without me knowing. It was using some random conda env version. In that case build didn’t work b/c it wasn’t registering with the correct Jupyter install.

In that case , I was able to debug things using quarto check

3 Likes

This looks like it changed recently:

Use IJulia’s built-in conda environment / jupyter install for julia notebooks/qmds
https://github.com/quarto-dev/quarto-cli/blob/v1.1.120/news/changelog-1.1.md?plain=1#L10

In older versions I had to set QUARTO_PYTHON to my IJulia conda c:\Users\username\.julia\conda\3\python.exe, since I don’t have python in my path.

Thank you SO much for this suggestion. I’m in Python environment hell, and your suggestion showed that for whatever reason, Quarto couldn’t find my Jupyter installation.

Where do I run this command?

Any recommendations in case the accepted solution does not work? Quarto was working fine for me, but I just updated to a newer version of Julia (1.8.5), and maybe this has “broken” something.

This seems to be an issue with Julia > 1.8.3 and it has been reported in the quarto-cli repository:

latest activity there 10h ago, so I guess it’s actively worked on.

Basically, if you install and build IJulia with julia version > 1.8.3, it will not work (I tested only with 1.8.5). I removed IJulia and re-installed and rebuilt it using 1.8.3 and it worked.