Getting quarto and IJulia to work

I have some issues getting Quarto and IJulia to work on my computer (Linux Mint) and standard tips don’t seem to work. What happens is the following:

  1. Trying to render a Quarto notebook results in the following error message:
➜  examples git:(main) ✗ quarto render RayleighQuotient.qmd

Starting julia-1.10 kernel...Traceback (most recent call last):
  File "/opt/quarto/share/jupyter/jupyter.py", line 21, in <module>
    from notebook import notebook_execute, RestartKernel
  File "/opt/quarto/share/jupyter/notebook.py", line 14, in <module>
    from yaml import safe_load
ModuleNotFoundError: No module named 'yaml'
  1. Trying to directly run the .ipynb notebook results in
ERROR: LoadError: ArgumentError: Package IJulia [7073ff75-c697-5162-941a-fcdaad2a7d2a] is required but does not seem to be installed:
 - Run `Pkg.instantiate()` to install all recorded dependencies.

but IJulia is installed and built (re-tried multiple times…)
3. .ipynb notebooks do work in VSCode but through its extension magic.
4. Ideally I’d like the notebook to be rendered with Julia’s Conda but it’s really hard to even figure out which Python is actually used by Quarto or jupyter-notebook.
5. It used to work perfectly fine before I upgraded from Julia 1.9 to 1.10.

Do you have any tips? I’ve spent a couple of hours trying to fix it and this is basically my last attempt before giving up.

1 Like

Maybe try activating the main quarto directory and running instantiate in that environment.

It didn’t work, still the No module named 'yaml' problem no matter how I try to run it. I’m not even sure which Python environment is supposed to have yaml. Both the system one and the Julia-Conda one have it.

It isn’t a great solution, but you might get something going if you set the jupyter value in your _quarto.yml file (or your header). I have something like this to force 1.10, you might use 1.9:

jupyter: julia-1.10

I know about it but it doesn’t really solve anything in the long term, in which case it’s better to just stop using quarto now.

Hm, sorry that that happens, if we find the error we can maybe include a fix also in our make script.

For now I just found Julia jupyter engine errors out · Issue #8067 · quarto-dev/quarto-cli · GitHub which issues exactly the same error message after exactly the same update.

1 Like

Thanks, this post was really helpful. It turns out that my Julia has two separate conda environments for some reason and only one of them had pyyaml. For reference, one was in /.julia/environments/v1.10/.CondaPkg/env, the other one in .julia/conda/3/bin/. I don’t know how that happened but maybe it will help someone fix it in the future.

1 Like

Indeed this looks like another instance of “Python hell”. You wrote in your initial post that " it’s really hard to even figure out which Python is actually used by Quarto". But in these situations you can use quarto check and you will get at least some diagnostics. Furthermore, through QUARTO_PYTHON you can set the path to the Python you want.

3 Likes

That’s a great tip. My solution was to add pyyaml to all three of my Python3.x distributions (mamba, homebrew, Julia conda) :laughing:. Eventually got it working, but was too lazy to isolate which one quarto was actually using.

We’re currently trying to get a native julia engine into quarto, which will alleviate all these python configuration issues. So you could keep an eye out for that Native Julia engine based on QuartoNotebookRunner.jl by jkrumbiegel · Pull Request #8645 · quarto-dev/quarto-cli · GitHub

7 Likes

That sounds absolutely great!
Currently rendering quarto in our documentation is a bit of a fight with Python dependencies as well (see this fun part for example Manopt.jl/docs/make.jl at 8de71e4344aafac3d70f9d9e8c55d629128ecd0c · JuliaManifolds/Manopt.jl · GitHub ), which is also one of the areas Mateusz was checking something I think.

That’s great! I generally like Quarto and configuration issues is basically my only gripe, I’m happy to see you work on improving it.