Weave.jl
Weave.jl copied to clipboard
Julia fails when saving an animation (Jupyer -> Markdown)
Julia essentially locks up when trying to render a Jupyter notebook with an animation through weave. I am also unable to send a SIGTERM with the keyboard, and I have to externally kill Julia. Here's a MWE:
Weave script:
using Weave
Weave.weave("fail_test.ipynb")
I've attached the notebook fail_test.ipynb
in a zip file here: fail_test.zip
The contents of the notebook are probably easier to copy than to unzip from the file, so you can also just copy the code below into a Jupyter cell:
using Plots
animation = @gif for i in 1:100
plot(i, i)
end
The console log:
[ Info: Weaving chunk 1 from line 0
┌ Info: Saved animation to
└ fn = "/tmp/jl_SZA4Ej.gif"
# Then we wait forever, cannot send
Environment, with Julia 1.3.1:
Status `~/code/TuringTutorials/fail-test/Project.toml`
[91a5bcdd] Plots v0.29.7
[f3b207a7] StatsPlots v0.14.1
[44d3d7a6] Weave v0.9.3
I noticed I was using 0.9.3, not 0.9.4. Sorry for the noise, everyone.
I'm re-opening this because it doesn't seem to be fixed with 0.9.4 in a consistent way.
Status
Status `~/code/TuringTutorials/fail-test/Project.toml`
[91a5bcdd] Plots v0.29.8
[44d3d7a6] Weave v0.9.4
Jupyter cell:
using Plots
animation = @gif for i in 1:10
plot(i, i)
end
Code to weave everything:
using Weave
Weave.weave("fail_test.ipynb", mod=Main)
Any ideas?
The issue also exists for standard figures when GR is the plotting backend.
Jupyter cell:
using Plots
plot(1:10, 1:10)
fails when weaved using:
using Weave
Weave.weave("fail_test.ipynb", mod=Main)
This fails on my computer running Julia-1.4 with:
(trying) pkg> st
Project trying v0.1.0
Status `/tmp/trying/Project.toml`
[91a5bcdd] Plots v0.29.8
[44d3d7a6] Weave v0.9.4
And it fails in such a way that it freezes on evaluating the cell, and then I see the CPU-usage for the julia process vanish :confused:
Can you try using Plots
before you weave
? Weave needs to load a specific script to handle these plot specific issues, it loads the script only when Plots
is already loaded.
Same issue if I load Plots first.
Does this issue only happen whey you weave
ing a notebook ? You can't reproduce it with the other formats like .jmd
or such ?
Seems to be fine if you weave from .jmd
.
I couldn't reproduce this issue on my environment. One possible cause would be that your OS may prevent making/removing a temporary directory that Weave creates for generating figures while weave
ing.
But 🤷♂
It would be helpful if you could tell me the exact timing when the freeze happens; before execution of chunks, during that, or after that ?
During the chunk weaving. If I have multiple chunks and one has an animation, weaving stops at the chunk with the animation.
I'm running Pop_OS! (Ubuntu clone) and I don't think it's a temporary directory issue, as regular plots work fine for me.
As a side note on your fix in #296, it's probably not going to help us much since Turing uses Weave to generate markdown files from our tutorial notebooks.
okay fair enough. so even weave(yournotebook, doctype = "github")
or weave(yournotebook, doctype = "md2html")
doesn't work ?
We currently use doctype="github"
, but I'll try md2html
. Give me a second. For the record, here's the full call Turuing's tutorial builder uses:
Weave.weave(full_path,
doctype = "github",
out_path = out_path,
mod = Main,
throw_errors = true)
Yeah, md2html
doesn't help either. Same issue.
Cool, thanks for the report. Will take a look again on this when I have time, but welcome if anyone wants to help us fix this.