JuliaPlots / PlotlyJS.jl

Julia library for plotting with plotly.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PlotlyJs.savefig() doesn't save static image - Kaleido is not avaiable

dlinhart14 opened this issue · comments

Describe the bug
When running simple PlotlyJS.savefig(PlotlyJS.Plot(PlotlyJS.scatter(x=[1,2,3],y=[10,20,30])),"test.png") nothing happens, empty .png file is created and executing is not finished. When executing is interrupted, following message is thrown:

ERROR: ┌ Warning: Kaleido is not available on this system. Julia will be unable to save images of any plots.
└ @ PlotlyJS C:\Users\david.linhart\.julia\packages\PlotlyJS\Jj38U\src\kaleido.jl:65

Same code created a year ago works, even when updated to latest versions. However, on any other pc it doesn't work even when downgraded PlotlyJS to v0.14.0, adding Kaleido by ]add Kaleido do not help either.

Version info

Julia Version 1.8.5
Commit 17cfb8e65e (2023-01-08 06:45 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 24 × 12th Gen Intel(R) Core(TM) i7-12850HX
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, goldmont)
  Threads: 1 on 24 virtual cores
Status `....\Testing\Project.toml`
  [f0f68f2c] PlotlyJS v0.18.10

I have the same problem, also running on Windows. Maybe a problem with the Windows Kaleido_jll binary?

commented

I'm having a similar issue with producing images of plots. Not sure if it is relevant, but there seems to be confusion around Kaledio vs Kaleido:
┌ Warning: Kaledio is not available on this system. Julia will be unable to produce any plots. └ @ PlotlyBase C:\Users\Monali\.julia\packages\PlotlyBase\NxSlF\src\kaleido.jl:58

Which is different from @dlinhart14 's warning.

I'm on
Julia Version 1.7.3 Commit 742b9abb4d (2022-05-06 12:58 UTC) Platform Info: OS: Windows (x86_64-w64-mingw32) CPU: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-12.0.1 (ORCJIT, skylake)

and
[f0f68f2c] PlotlyJS v0.15.0

I can't reproduce this issue on the following machine

julia> versioninfo()
Julia Version 1.8.5
Commit 17cfb8e65e (2023-01-08 06:45 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 16 × 11th Gen Intel(R) Core(TM) i9-11900K @ 3.50GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, rocketlake)
  Threads: 1 on 16 virtual cores

Maybe some antivirus software is blocking the execution of the kaleido process?

Unfortunately, it is not caused by antivirus blocking and it still doesn't work.

Hi,
I have the same problem, with this version :

versioninfo()
Julia Version 1.8.5
Commit 17cfb8e65e (2023-01-08 06:45 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 20 × 12th Gen Intel(R) Core(TM) i7-1280P
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, goldmont)
  Threads: 8 on 20 virtual cores
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS =

I have this issus from few month now, the only solution I found is saving as HTML... But HTML isn't intente for the same use as PNG and other !
BR
Francois

I'm not sure whether the problem I'm having is the same or not, but here are my code and error messages.

using Plots
plotly()
xs=-5:1:5
ys=-5:1:5
var = [ x^2 + y^2 for x in xs, y in ys]
#p = contourf(xs, ys, var; color=:redsblues, levels=5:5:40)
p = contourf(xs, ys, var)
savefig(p, "tmp.png")

and

┌ Warning: `PlotlyKaleido` 2.1.0 is not compatible with this version of `Plots`. The declared compatibility is 1.
└ @ Plots ~/.julia/packages/Plots/3BCH5/src/backends.jl:55
ERROR: LoadError: UndefRefError: access to undefined reference
Stacktrace:
  [1] getproperty
    @ ./Base.jl:37 [inlined]
  [2] save_payload(io::IOStream, payload::String, format::String)
    @ PlotlyKaleido ~/.julia/packages/PlotlyKaleido/gfUAu/src/PlotlyKaleido.jl:88
  [3] #savefig#3
    @ ~/.julia/packages/PlotlyKaleido/gfUAu/src/PlotlyKaleido.jl:106 [inlined]
  [4] _show(io::IOStream, #unused#::MIME{Symbol("image/png")}, plt::Plots.Plot{Plots.PlotlyBackend})
    @ Plots ~/.julia/packages/Plots/3BCH5/src/backends/plotlybase.jl:21
  [5] #invokelatest#2
    @ ./essentials.jl:816 [inlined]
  [6] invokelatest
    @ ./essentials.jl:813 [inlined]
  [7] show
    @ ~/.julia/packages/Plots/3BCH5/src/output.jl:232 [inlined]
  [8] #344
    @ ~/.julia/packages/Plots/3BCH5/src/output.jl:6 [inlined]
  [9] open(::Plots.var"#344#345"{Plots.Plot{Plots.PlotlyBackend}}, ::String, ::Vararg{String}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base ./io.jl:395
 [10] open
    @ ./io.jl:392 [inlined]
 [11] png(plt::Plots.Plot{Plots.PlotlyBackend}, fn::String)
    @ Plots ~/.julia/packages/Plots/3BCH5/src/output.jl:6
 [12] savefig(plt::Plots.Plot{Plots.PlotlyBackend}, fn::String)
    @ Plots ~/.julia/packages/Plots/3BCH5/src/output.jl:149
 [13] top-level scope
    @ ~/Dropbox/jwk/try-contour.jl:8
 [14] include(fname::String)
    @ Base.MainInclude ./client.jl:478
 [15] top-level scope
    @ REPL[1]:1
in expression starting at /Users/furue/Dropbox/jwk/try-contour.jl:8

I'm using julia 1.9.2 from juliaup on macOS 13.5 . The above julia program works with the default backend.

Downgrading Julia to 1.5.4 solves the problem for me.

Downgrading Julia to 1.5.4 solves the problem for me.

Reverted back to Julia 1.9.4 and followed step 2 in sglyon/PlotlyBase.jl#40 (comment). It worked for me.

I have this problem as well, and haven't found a combination of downgraded versions of either Julia or PlotlyJS, that makes PlotlyJS work on windows. Not being able to save figures is a game breaker. Unfortunately @make296 's solution did not work for me.

julia> versioninfo()
Julia Version 1.9.4
Commit 8e5136fa29 (2023-11-14 08:46 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 24 × 13th Gen Intel(R) Core(TM) i7-13700HX
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, goldmont)
  Threads: 1 on 24 virtual cores

@mattcbro Did you first install PlotlyJS and then replace the Kaleido folder?

This should be solved now. See the related comment in #473 (comment) for more details