Quarto Julia CLI: Kernel died before replying to kernel_info

I wanted to try out quarto for Julia code.

  1. I created an new Julia environment q and installed IJulia.jl and Plots.jl

  2. The jupyter kernelspec & quarto check all seem fine.

  3. when trying to render Julia example Quarto - Using Julia it gives error message

C:\julia110>quarto render jex.qmd
Starting julia-1.10 kernel...ERROR:

Kernel died before replying to kernel_info
  1. How do I make jupyter and quarto use IJulia from the q project environment from the CLI?

JUPYTER ERROR

:\julia110>jupyter notebook                                                                                        
I 15:34:19.098 NotebookApp] Serving notebooks from local directory: d:\sw\julia110                                    
I 15:34:19.099 NotebookApp] Jupyter Notebook 6.4.0 is running at:                                                     
I 15:34:19.099 NotebookApp] http://localhost:8888/?token=388689f07367fe64f93c7c0ef28a25d996e9fe6079e69b25             
I 15:34:19.100 NotebookApp]  or http://127.0.0.1:8888/?token=388689f07367fe64f93c7c0ef28a25d996e9fe6079e69b25         
I 15:34:19.100 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). 
C 15:34:19.275 NotebookApp]                                                                                           
                                                                                                                      
   To access the notebook, open this file in a browser:                                                               
       file:///C:/Users/julius/AppData/Roaming/jupyter/runtime/nbserver-29468-open.html                                    
   Or copy and paste one of these URLs:                                                                               
       http://localhost:8888/?token=388689f07367fe64f93c7c0ef28a25d996e9fe6079e69b25                                  
    or http://127.0.0.1:8888/?token=388689f07367fe64f93c7c0ef28a25d996e9fe6079e69b25                                  
I 15:34:32.208 NotebookApp] Creating new notebook in                                                                  
I 15:34:42.668 NotebookApp] Kernel started: 8f1d47d2-550f-4529-9d1f-1f0a28489d22, name: julia-1.10                    
RROR: LoadError: ArgumentError: Package IJulia not found in current path.                                             
 Run `import Pkg; Pkg.add("IJulia")` to install the IJulia package.                                                   
tacktrace:                                                                                                            
[1] macro expansion                                                                                                   
  @ .\loading.jl:1257 [inlined]                                                                                       
[2] macro expansion                                                                                                   
  @ .\lock.jl:267 [inlined]                                                                                           
[3] require(into::Module, mod::Symbol)                                                                                
  @ Base .\loading.jl:1238                                                                                            

KERNELSPEC LIST

C:\julia110>jupyter kernelspec list
Available kernels:
  julia-1.10             C:\Users\julius\AppData\Roaming\jupyter\kernels\julia-1.10
  wolframlanguage13.1    C:\Users\julius\AppData\Roaming\jupyter\kernels\wolframlanguage13.1
  python3                C:\python\app\python\share\jupyter\kernels\python3

QUARTO CHECK

C:\julia110>quarto check                             
                                                        
[>] Checking Quarto installation......OK                
      Version: 1.3.47                                   
      Path: C:\quarto\bin                            
      CodePage: 65001                                   
                                                        
[>] Checking basic markdown render....OK                
                                                        
[>] Checking Python 3 installation....OK                
      Version: 3.8.6                                    
      Path: C:/python/App/Python/python.exe          
      Jupyter: 4.7.1                                    
      Kernels: julia-1.10, wolframlanguage13.1, python3 
                                                        
[>] Checking Jupyter engine render....OK                
                                                        
[>] Checking R installation...........OK                
      Version: 4.2.2                                    
      Path: C:/R-Portable/App/R-Portable             
      LibPaths:                                         
        - C:/R-Portable/App/R-Portable/library       
      rmarkdown: 2.18                                   
                                                        
[>] Checking Knitr engine render......OK                
                                                        

Yes, I did that much before.

julia> using Pkg; Pkg.build("IJulia")
    Building Conda ─→ `C:\julia110\.julia\scratchspaces\44cfe95a-1eb2-52ea-b672-e2afdf69b78f\6e47d11ea2776bc5627421d59cdcc1296c058071\build.log`
    Building IJulia → `C:\julia110\.julia\scratchspaces\44cfe95a-1eb2-52ea-b672-e2afdf69b78f\98ab633acb0fe071b671f6c1785c46cd70bb86bd\build.log`

After a lot of fiddling, the reason for this error is that when IJulia installs the jupyter kernel, it sets the project path to default i.e. --project=@. in the C:\Users\julius\AppData\Roaming\jupyter\kernels\julia-1.10\kernel.json file

jupyter kernelspec list

julia-1.10             C:\Users\s\AppData\Roaming\jupyter\kernels\julia-1.10

We need to manually alter the file to change the project to the one we want as shown below. We have replaced --project=@. with --project=q

kernel.json

{
  "display_name": "Julia 1.10.0-DEV",
  "argv": [
    "c:\\julia110\\bin\\julia.exe",
    "-i",
    "--color=yes",
    "--project=q",
    "c:\\julia110\\.julia\\packages\\IJulia\\AQu2H\\src\\kernel.jl",
    "{connection_file}"
  ],
  "language": "julia",
  "env": {},
  "interrupt_mode": "message"
}

original kernel.json

{
  "display_name": "Julia 1.10.0-DEV",
  "argv": [
    "c:\\julia110\\bin\\julia.exe",
    "-i",
    "--color=yes",
    "--project=@.",
    "c:\\julia110\\.julia\\packages\\IJulia\\AQu2H\\src\\kernel.jl",
    "{connection_file}"
  ],
  "language": "julia",
  "env": {},
  "interrupt_mode": "message"
}

Now both quarto and jupyter are able to find IJulia.

1 Like

I have the same issue, but setting --project=q does not solve the problem for me on Linux (Btw: what does it mean?). IJulia works inside Julia REPL, and quarto check also says ok:

[✓] Checking Quarto installation......OK
      Version: 1.2.313
      Path: /opt/quarto/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.6.9
      Path: /usr/bin/python
      Jupyter: 4.9.2
      Kernels: python3, julia-1.8, python2

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 3.6.3
      Path: /usr/lib/R
      LibPaths:
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      rmarkdown: (None)

      The rmarkdown package is not available in this R installation.
      Install with install.packages("rmarkdown")

However I don’t encounter the issue on my Win11 laptop.

1 Like

setting --project=q does not solve the problem for me on Linux (Btw: what does it mean?)

TLDR: I guess I didn’t explain properly above but q is the name of the Julia project I created inside which I did install IJulia. You should substitute with the project name where IJulia is installed.

Longer Explanation:

A Julia ‘project’ is equivalent to a conda ‘environment’. It is a self-contained directory contains your specific packages.

  1. After starting julia, if you type ], it should take you to the package mode.
  2. Here you should see something like (@v1.10) pkg> depending on your version. This is the default project environment of Julia. This corresponds to --project=@. in the JSON kernel file.
  3. How this works inside Julia REPL is that:
    ]activate . opens the current directory as the project environment.
    ]activate opens the default julia project as the project environment.
    ]activate projname opens the projname project as the project environment.
  4. Say you created a project named ijuliaproj and installed IJulia in it, then you should use --project=ijuliaproj in the kernel JSON file.

Hope this helps some more. Let me know if you have any further difficulties. :+1:

Thanks for the explanation! But I guess if I install IJulia not inside my project but in global Julia environment, this should not matter?

I found this issue reported in the quarto repo.

These are two independent issues as far as I know.

1a. If IJulia is installed in the default environment, then you don’t need to tinker with the kernel JSON.

1b. If IJulia is installed in a project say qq, then you need to specify qq in the kernel JSON

2a) The kernel not starting was an IJulia problem because it only recognized till Juliav1.8. It gave that error for Juliav1.9 & Juliav1.10. We complained and it was finally fixed in Kernel does not start with Julia 1.9 · Issue #1062 · JuliaLang/IJulia.jl · GitHub

2b) Now your issue is for quarto+IJulia. It could be a Linux issue. IDK.

For me the Windows 10, IJulia installed in qq project. So quarto works for the example in the Quarto website: Quarto - Using Julia

It’s definitely not easy when the workflow consists of many tools!!

julia> exit()

C:\julia110>quarto render document.qmd

Starting julia-1.10 kernel...Done

Executing 'document.ipynb'
  Cell 1/1...Done

pandoc
  to: html
  output-file: document.html
  standalone: true
  section-divs: true
  html-math-method: mathjax
  wrap: none
  default-image-extension: png

metadata
  document-css: false
  link-citations: true
  date-format: long
  lang: en
  title: Plots Demo
  author: Norah Jones
  date: 5/22/2021
  jupyter: julia-1.10

Output created: document.html

This was the screenshot of output HTML file.

1 Like

Just a quick update, since it hasn’t been discussed here anymore:

This bug is fixed in Quarto 1.3.

4 Likes