JunoLab / Weave.jl

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

[BUG] Plotly html output not working. ERROR: BoundsError #337

Open AsimHDar opened 4 years ago

AsimHDar commented 4 years ago

Description

When producing html output, plots made with plotly backend give an error

This is what I see in the generated report:

image

versions

using InteractiveUtils; versioninfo():

Julia Version 1.4.1
Commit 381693d3df* (2020-04-14 17:20 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-8.0.1 (ORCJIT, skylake)
Environment:
JULIA_EDITOR = "C:\Users\asimd\AppData\Local\atom\app-1.47.0\atom.exe"  -a
JULIA_NUM_THREADS = 3

using Pkg; Pkg.status():

[c52e3926] Atom v0.12.11
[94b1ba4f] AxisKeys v0.1.3
[ad839575] Blink v0.12.3
[717857b8] DSP v0.6.7
[31a5f54b] Debugger v0.6.4
[31c24e10] Distributions v0.23.2
[634d3b9d] DrWatson v1.11.0
[7a1cc6ca] FFTW v1.2.1
[6a3955dd] ImageFiltering v0.6.11
[e5e0dc1b] Juno v0.8.2
[23992714] MAT v0.8.0
[442fdcdd] Measures v0.3.1
[288cda28] MegTools v0.1.0 [`C:\Users\asimd\.julia\dev\MegTools`]
[47be7bcc] ORCA v0.3.1
[5fb14364] OhMyREPL v0.5.5
[f0f68f2c] PlotlyJS v0.13.1
[91a5bcdd] Plots v1.3.1 #master (https://github.com/JuliaPlots/Plots.jl.git)
[08abe8d2] PrettyTables v0.9.0
[d330b81b] PyPlot v2.9.0
[295af30f] Revise v2.6.6
[322a6be2] Sass v0.1.0
[2913bbd2] StatsBase v0.33.0
[f3b207a7] StatsPlots v0.14.6
[30cdaa97] SystemBenchmark v0.3.0 #master (https://github.com/ianshmean/SystemBenchmark.jl)
[40c74d1a] TableView v0.6.0
[29a6e085] Wavelets v0.9.0
[44d3d7a6] Weave v0.10.0
[37e2e46d] LinearAlgebra
[9a3f8284] Random 
[10745b16] Statistics

Minimum reproducible steps

using Plots
plotly()
plot(rand(10))

gr()
plot(rand(10))

In REPL:

using Weave
weave("my_script.jl")
aviatesk commented 4 years ago

in this environment your example works:

plotenv) pkg> st
Status `...`
  [91a5bcdd] Plots v1.3.1

so, let's try to create a separate environment that only contains Plots and try weave there. (it's okay to keep Weave in your default environment)

AsimHDar commented 4 years ago

Thanks for testing it out, but it still gives me the same error.

using Weave

st
Status `C:\Users\asimd\keft\Project.toml`
  [91a5bcdd] Plots v1.3.1

weave("test.jl")
┌ Warning: ERROR: BoundsError occurred, including output in Weaved document
└ @ Weave C:\Users\asimd\.julia\packages\Weave\74s70\src\run.jl:248
[ Info: Report weaved to test.html
"C:\\Users\\asimd\\keft\\test.html"
aviatesk commented 4 years ago

ah, so you're weaving a script. then it might be Weave itself causes the problem. I'll take a look at this later

aviatesk commented 4 years ago

okay, so my current guess is that this line causes this problem. well this doesn't happen on macOS (I'm using), but I'm sure that code should be refactored into more robust code.

I will let you know when I tweak the code. Would be very appreciated if you can test that on your machine then.

AsimHDar commented 4 years ago

That sounds good, thanks for taking a look 👍

aviatesk commented 4 years ago

fwiw, do you have some special setup for plotting in your startup script ?

AsimHDar commented 4 years ago

Nope.

AsimHDar commented 4 years ago

Installed Juliapro with the same Julia version (1.4.1) to test this, and it works

Status C:\Users\asimd\.juliapro\JuliaPro_v1.4.1-1\environments\v1.4\Project.toml [c52e3926] Atom v0.12.10 ⚲ [7073ff75] IJulia v1.20.0 [e5e0dc1b] Juno v0.8.1 ⚲ [442fdcdd] Measures v0.3.1 [4722fa14] PkgAuthentication v0.1.2 [91a5bcdd] Plots v1.0.14 [44d3d7a6] Weave v0.9.4

I tried using those versions of plots and weave, but to no avail. Any ideas how this differs from my other installation? Is a fresh start the only way?

aviatesk commented 4 years ago

I'm still on a way to find a solution, but here is my understanding:

Will take another look on this when I have time.

AsimHDar commented 3 years ago

Any updates on this? Is this because I'm on windows or something?

betanaught commented 3 years ago

Hi, I am also having this same error using Julia version 1.6.1 on macOS 11.3. I just tested a Julia environment with only Plots and Weave added: [91a5bcdd] Plots v1.13.2 [44d3d7a6] Weave v0.10.8

I made the same .jmd file as OP and ran weave("test.jmd", doctype="md2html"). If it's helpful, weave("radiometer.jmd", doctype="md2pdf") works to generate a PDF (I have a Homebrew installation of mactex).

Let me know if there's anything else I can test (Debugger output, etc.)

EDIT May 11, 2021: I uninstalled Julia with Homebrew and removed Plots, Weave, PlotlyBase, Gadfly, and Cairo from my v1.6 environment, and reinstalled Julia (1.6.1), Plots (1.14.0), and Weave (0.10.8) to the same environment. I can now include plotly plots in my html output documents

atc01 commented 3 years ago

I too have this issue. I am running on Ubuntu 21.04 with Nix Home Manager. My versions are as follows:

  [336ed68f] CSV v0.8.5
  [5d742f6a] CSVFiles v1.0.1
  [a93c6f00] DataFrames v1.1.1
  [5789e2e9] FileIO v1.9.1
  [39abe10b] MySQL v1.2.0
  [a03496cd] PlotlyBase v0.5.3
  [91a5bcdd] Plots v1.16.2
  [0aa819cd] SQLite v1.1.4
  [44d3d7a6] Weave v0.10.9

Edit: since removing PlotlyBase this seems to be working fine:

(@v1.6) pkg> rm "PlotlyBase"                           
    Updating `~/.julia/environments/v1.6/Project.toml` 
  [a03496cd] - PlotlyBase v0.5.3
    Updating `~/.julia/environments/v1.6/Manifest.toml`
  [a03496cd] - PlotlyBase v0.5.3                       
  [f7e6163d] - Kaleido_jll v0.1.0+0

@v1.6) pkg> st                                       
     Status `~/.julia/environments/v1.6/Project.toml`
 [336ed68f] CSV v0.8.5
 [5d742f6a] CSVFiles v1.0.1
 [a93c6f00] DataFrames v1.1.1
 [5789e2e9] FileIO v1.9.1
 [39abe10b] MySQL v1.2.0
 [91a5bcdd] Plots v1.16.2
 [0aa819cd] SQLite v1.1.4
 [44d3d7a6] Weave v0.10.9