JunoLab / Weave.jl

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

hangs with plots [BUG] #436

Open Ossifragus opened 2 years ago

Ossifragus commented 2 years ago

description

Weave hangs if plots are includes.

versions

using InteractiveUtils; versioninfo():

Julia Version 1.6.2
Commit 1b93d53fc4 (2021-07-14 15:36 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, haswell)
Environment:
JULIA_NUM_THREADS = 4

using Pkg; Pkg.status():


Status `~/.julia/environments/v1.6/Project.toml`
[69666777] Arrow v1.6.2
[ad839575] Blink v0.12.5
[336ed68f] CSV v0.8.5
[324d7699] CategoricalArrays v0.10.0
[944b1d66] CodecZlib v0.7.0
[a93c6f00] DataFrames v1.2.2
[1313f7d8] DataFramesMeta v0.9.0
[31a5f54b] Debugger v0.6.8
[31c24e10] Distributions v0.25.11
[cc61a311] FLoops v0.1.10
[becb17da] Feather v0.5.9
[da1fdf0e] FreqTables v0.4.4
[09f84164] HypothesisTests v0.10.4
[7073ff75] IJulia v1.23.2
[82e4d734] ImageIO v0.5.7
[916415d5] Images v0.22.5
[c8e1da08] IterTools v1.3.0
[babc3d20] JDF v0.4.4
[9da8a3cd] JLSO v2.6.0
[b9914132] JSONTables v1.0.1
[b964fa9f] LaTeXStrings v1.2.1
[23fbe1c1] Latexify v0.15.6
[ae8d54c2] Luxor v2.15.0
[ff71e718] MixedModels v4.0.0
[5fb14364] OhMyREPL v0.5.10
[9b87118b] PackageCompiler v1.3.0
[b98c9c47] Pipe v1.3.0
[f0f68f2c] PlotlyJS v0.15.0
[91a5bcdd] Plots v1.20.1
[c3e4b0f8] Pluto v0.15.1
[7f904dfe] PlutoUI v0.7.1
[6cfbe66a] QRCode v0.1.0
[6f49c342] RCall v0.13.12
[79098fc4] Rmath v0.7.0
[2913bbd2] StatsBase v0.33.9
[3eaba693] StatsModels v0.6.24
[f3b207a7] StatsPlots v0.14.26
[fd094767] Suppressor v0.2.0
[ebf5ac4f] TexTables v0.2.4
[b8865327] UnicodePlots v2.0.0
[44d3d7a6] Weave v0.10.10
[a5390f91] ZipFile v0.9.3
[a63ad114] Mmap

## minimum reproducible steps

<!-- if possible, paste here a minimum reproducible example document and steps -->
Put the following code in 00.jl and run `weave("00.jl", cache=:off, out_path="output/")
`.
```julia
#' # Plot
x = rand(2, 10)
#' Create a histogram.
using Plots
plot(x[1,:])
#' Create a scatter plot
plot(x[1,:], x[2,:])

The weaving hangs at

julia> weave("00.jl", cache=:off, out_path="output/")
┌ Info: Weaving chunk 1 from line 2
└   progress = 0.0
┌ Info: Weaving chunk 2 from line 4
└   progress = 0.3333333333333333
┌ Info: Weaving chunk 2 from line 7
└   progress = 0.6666666666666666
Ossifragus commented 2 years ago

Just found that things work in VSCode, but not in the repl nor emacs with vterm.

Ossifragus commented 2 years ago

If I start julia from a terminal, then it works. Maybe this is a problem for emacs julia-repl with vterm. I will test further.

Ossifragus commented 2 years ago

I do not fully understand the cause, but the problem is related to using X server with gksqt. Here is a workaround:

ENV["GKSwstype"]="nul"
weave("00.jl", cache=:off, out_path="output/")
ENV["GKSwstype"]="gksqt"

The first line ENV["GKSwstype"]="nul" activates the NULL device so that X server will not be requested. After this, weave("00.jl", cache=:off, out_path="output/") works as expected. The third line ENV["GKSwstype"]="gksqt" activates gksqt in case some plots need to be displayed.

newptcai commented 2 years ago
ENV["GKSwstype"]="nul"

I can report this walk-around does work.

00krishna commented 2 years ago

I just got hit by this bug too, when I tried to run Weave from my terminal. The fix worked though.

newptcai commented 2 years ago

It seems that there had not been any bug-fixing for quite a while. I wonder if the project has been abandoned? Can we make some donations so as to motivate the maintainer to fix some bugs?

00krishna commented 2 years ago

@newptcai I am pretty sure that the project is still maintained. I mean so many people use Weave for everything. It might just be that a lot of the code is pretty stable? That is what I am hoping. I still use Weave for so many things, not sure what would replace it.

patrickm663 commented 1 year ago

I do not fully understand the cause, but the problem is related to using X server with gksqt. Here is a workaround:

ENV["GKSwstype"]="nul"
weave("00.jl", cache=:off, out_path="output/")
ENV["GKSwstype"]="gksqt"

The first line ENV["GKSwstype"]="nul" activates the NULL device so that X server will not be requested. After this, weave("00.jl", cache=:off, out_path="output/") works as expected. The third line ENV["GKSwstype"]="gksqt" activates gksqt in case some plots need to be displayed.

Thanks, this helped me when my plots were hanging!