JunoLab / Weave.jl

Scientific reports/literate programming for Julia
http://weavejl.mpastell.com
MIT License
823 stars 94 forks source link

[BUG] Error when invoking Gadfly #403

Open backwardscoder opened 3 years ago

backwardscoder commented 3 years ago

description

I posted a question at the discourse forums, but now I suspect that this perhaps is a bug. Reference: https://discourse.julialang.org/t/im-not-able-to-use-gadfly-weave/47810

I have a very simple .jmd file

\```julia
using Gadfly
x = range(0, step=0.1, stop=2*pi)
println(x)
Gadfly.plot(x = x, y = sin.(x))
\```

(I had to escape the backticks when composing this message). When calling weave on the .jmd file, I get an error (see below). If I replace “Gadfly” with “Plots”, it works. If I run the code snippet in REPL, it works with both Plots and Gadfly. So why does it fail when using Gadfly in Weave?

Julia code invoking weave: weave("path/to/file.jmd", out_path=save_path, doctype = "md2html", mod=mymodule)

Error:

┌ Info: Weaving chunk 1 from line 8
└   progress = 0.0
┌ Info: Weaving chunk 2 from line 16
└   progress = 0.5
┌ Warning: ERROR: ErrorException occurred, including output in Weaved document
└ @ Weave C:\path\.julia\packages\Weave\lf3HS\src\run.jl:234
┌ Info: Weaved all chunks
└   progress = 1
ERROR: LoadError: SystemError: opening file "D:\\mypath\\reports\\20201005__20_56_56_605\\jl_ngvppF/report_2_1.png": No such file or directory
Stacktrace:
 [1] systemerror(::String, ::Int32; extrainfo::Nothing) at .\error.jl:168
 [2] #systemerror#48 at .\error.jl:167 [inlined]
 [3] systemerror at .\error.jl:167 [inlined]
 [4] open(::String; lock::Bool, read::Bool, write::Nothing, create::Nothing, truncate::Nothing, append::Nothing) at .\iostream.jl:284
 [5] open(::String, ::String; lock::Bool) at .\iostream.jl:346
 [6] open at .\iostream.jl:346 [inlined]
 [7] img2base64(::String, ::String) at C:\path\.julia\packages\Weave\lf3HS\src\run.jl:152
 [8] embed_figures!(::Weave.CodeChunk, ::String) at C:\path\.julia\packages\Weave\lf3HS\src\run.jl:140
 [9] embed_figures! at C:\path\.julia\packages\Weave\lf3HS\src\run.jl:146 [inlined]
 [10] run_chunk(::Weave.CodeChunk, ::Weave.WeaveDoc, ::Weave.Report, ::Module) at C:\path\.julia\packages\Weave\lf3HS\src\run.jl:134
 [11] run_doc(::Weave.WeaveDoc; doctype::String, out_path::String, args::Dict{Any,Any}, mod::Module, fig_path::Nothing, fig_ext::Nothing, cache_path::String, cache::Symbol) at C:\path\.julia\packages\Weave\lf3HS\src\run.jl:74
 [12] weave(::String; doctype::String, informat::Nothing, out_path::String, args::Dict{Any,Any}, mod::Module, fig_path::Nothing, fig_ext::Nothing, cache_path::String, cache::Symbol, template::Nothing, css::Nothing, highlight_theme::Nothing, pandoc_options::Array{String,1}, latex_cmd::Array{String,1}, keep_unicode::Bool) at C:\path\.julia\packages\Weave\lf3HS\src\Weave.jl:177
 ...
 [20] top-level scope at .\REPL[4]:0
in expression starting at D:\mypath\myfile.jl:38

versions

using InteractiveUtils; versioninfo():

Julia Version 1.5.0
Commit 96786e22cc (2020-08-01 23:44 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i5-6400 CPU @ 2.70GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
Environment:
JULIA_REVISE = auto

using Pkg; Pkg.status():

[6e4b80f9] BenchmarkTools v0.5.0
[336ed68f] CSV v0.7.7
[159f3aea] Cairo v1.0.5
[a93c6f00] DataFrames v0.21.6
[743a1d0a] DataTables v0.1.0
[31a5f54b] Debugger v0.6.5
[c91e804a] Gadfly v1.3.0
[cd3eb016] HTTP v0.8.17
[682c06a0] JSON v0.21.0
[194296ae] LibPQ v1.5.0
[b98c9c47] Pipe v1.3.0
[91a5bcdd] Plots v1.6.3
[1a8c2f83] Query v1.0.0
[2aef5ad7] QueryOperators v0.9.1
[295af30f] Revise v1.0.3
[bd369af6] Tables v1.0.5
[44d3d7a6] Weave v0.10.5
NicholasWMRitchie commented 2 years ago

You probably need to "add Fontconfig" since PNG generation in Gadfly requires both Cairo and Fontconfig.