quarto-dev / quarto-dev/quarto-cli

julia chunk errors when using knitr

Open
#7,752 3 comments 2 reactions 1 assignee View on GitHub

@cderv is already working on this.

Since Nov 30, 2023.

bug engines-julia engines-knitr third-party
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Bug description

Having julia chunks leads to error when there is an R chunk too; not in all cases, but e.g. when using Plots but also many other packages. The julia chunks work when executed in julia cli, and also when the R chunk is removed (but then the Python section is ignored). When removing the Plots part, doing only the DatFrame and CSV part, the julia chunk does not throw an error.

Steps to reproduce
# Introduction

```{r}
1
```

```{julia}
using DataFrames
using CSV
path = joinpath(pkgdir(DataFrames), "docs", "src", "assets", "german.csv");
german_ref = CSV.read(path, DataFrame)

using Plots
plot(x->x)
```

```{python}
a = 3
```
Expected behavior

It should create the plot and inline it.

Actual behavior

An error occurs; the following output is generated:

$ quarto render index.qmd


processing file: index.qmd
1/7                  
2/7 [unnamed-chunk-1]
3/7                  
4/7 [unnamed-chunk-2]
Julia version 1.9.4 at location /home/edzer/julia-1.9.4/bin will be used.
Loading setup script for JuliaCall...
Finish loading setup script for JuliaCall.



Quitting from lines 8-15 [unnamed-chunk-2] (index.qmd)
Error:
! Error happens in Julia.
InitError: could not load library "/home/edzer/.julia/artifacts/b6ebc4def1211ec4043d7c055f450d59f56747cc/lib/libgobject-2.0.so"
/home/edzer/.julia/artifacts/b6ebc4def1211ec4043d7c055f450d59f56747cc/lib/libgobject-2.0.so: undefined symbol: g_bookmark_file_copy
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl ./libdl.jl:117
  [2] dlopen(s::String, flags::UInt32)
    @ Base.Libc.Libdl ./libdl.jl:116
  [3] macro expansion
    @ ~/.julia/packages/JLLWrappers/pG9bm/src/products/library_generators.jl:63 [inlined]
  [4] __init__()
    @ Glib_jll ~/.julia/packages/Glib_jll/MZy06/src/wrappers/x86_64-linux-gnu.jl:36
  [5] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1115
  [6] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})
    @ Base ./loading.jl:1061
  [7] _tryrequire_from_serialized(modkey::Base.PkgId, path::String, ocachepath::String, sourcepath::String, depmods::Vector{Any})
    @ Base ./loading.jl:1391
  [8] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128)
    @ Base ./loading.jl:1494
  [9] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:1783
 [10] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1660
 [11] macro expansion
    @ ./loading.jl:1648 [inlined]
 [12] macro expansion
    @ ./lock.jl:267 [inlined]
 [13] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1611
 [14] top-level scope
    @ none:3
 [15] eval(m::Module, e::Any)
    @ Core ./boot.jl:370
 [16] top-level scope
    @ ~/R/x86_64-pc-linux-gnu-library/4.3/JuliaCall/julia/RmdStd.jl:15
 [17] eval
    @ ./boot.jl:370 [inlined]
 [18] eval_string(x::String)
    @ Main.JuliaCall ~/R/x86_64-pc-linux-gnu-library/4.3/JuliaCall/julia/setup.jl:203
 [19] docall(call1::Ptr{Nothing})
    @ Main.JuliaCall ~/R/x86_64-pc-linux-gnu-library/4.3/JuliaCall/julia/setup.jl:176
during initialization of module Glib_jll
Backtrace:
  1. global .main()
  2. execute(...)
  3. rmarkdown::render(...)
  4. knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
  5. knitr:::process_file(text, output)
     ...
 17. JuliaCall:::stdout_capture_command(buffer)
 18. base::tryCatch(...)
 19. base (local) tryCatchList(expr, classes, parentenv, handlers)
 20. base (local) tryCatchOne(...)
 21. value[[3L]](cond)
Execution halted
Julia exit.
Your environment

Ubuntu 22.04, nvim

Quarto check output
Quarto 1.4.514
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.9: OK
      Dart Sass version 1.69.5: OK
      Deno version 1.37.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.4.514
      Path: /opt/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /usr/bin
      Version: 2021

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

[✓] Checking Python 3 installation....OK
      Version: 3.11.5 (Conda)
      Path: /home/edzer/miniconda3/bin/python
      Jupyter: 5.5.0
      Kernels: julia-1.9, python3

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

[✓] Checking R installation...........OK
      Version: 4.3.2
      Path: /usr/lib/R
      LibPaths:
        - /home/edzer/R/x86_64-pc-linux-gnu-library/4.3
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      knitr: 1.45
      rmarkdown: 2.24

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.