PlotlyJS.jl icon indicating copy to clipboard operation
PlotlyJS.jl copied to clipboard

PlotlyJS.savefig (v0.18.8) not working on M1 mac running Julia 1.7-1.9 (arm64)

Open truedichotomy opened this issue 2 years ago • 3 comments

When I tried to save a jpeg figure using PlotlyJS, it fails on M1 mac running Julia v1.7. The same example runs fine on a Intel mac:

using PlotlyJS

function linescatter1()
    trace1 = scatter(;x=1:4, y=[10, 15, 13, 17], mode="markers")
    plot([trace1])
end
linescatter1()

testio = open("test.jpg", "w")
PlotlyJS.savefig(testio, linescatter1(); format="jpeg");
close(testio)

The error output is:

julia> PlotlyJS.savefig(testio, linescatter1(); format="jpeg");
┌ Warning: Kaleido is not available on this system. Julia will be unable to save images of any plots.
└ @ PlotlyJS ~/.julia/packages/PlotlyJS/4jzLr/src/kaleido.jl:65
┌ Warning: UndefVarError(:artifact_dir)
└ @ PlotlyJS ~/.julia/packages/PlotlyJS/4jzLr/src/kaleido.jl:66
ERROR: UndefRefError: access to undefined reference
Stacktrace:
 [1] getproperty
   @ ./Base.jl:42 [inlined]
 [2] savefig(p::Plot{Vector{GenericTrace{Dict{Symbol, Any}}}, Layout{Dict{Symbol, Any}}, Vector{PlotlyFrame}}; width::Nothing, height::Nothing, scale::Nothing, format::String)
   @ PlotlyJS ~/.julia/packages/PlotlyJS/4jzLr/src/kaleido.jl:98
 [3] savefig(p::PlotlyJS.SyncPlot; kwargs::Base.Pairs{Symbol, Union{Nothing, String}, NTuple{4, Symbol}, NamedTuple{(:width, :height, :scale, :format), Tuple{Nothing, Nothing, Nothing, String}}})
   @ PlotlyJS ~/.julia/packages/PlotlyJS/4jzLr/src/kaleido.jl:71
 [4] savefig(io::IOStream, p::PlotlyJS.SyncPlot; width::Nothing, height::Nothing, scale::Nothing, format::String)
   @ PlotlyJS ~/.julia/packages/PlotlyJS/4jzLr/src/kaleido.jl:154
 [5] top-level scope
   @ REPL[29]:1
julia> versioninfo()
Julia Version 1.7.0
Commit 3bf9d17731 (2021-11-30 12:12 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin21.1.0)
  CPU: Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, cyclone)

truedichotomy avatar Dec 02 '21 21:12 truedichotomy

Same issue. Waiting for Kaleido Julia-wrapper to be updated. Kaleido itself released the arm64 version months ago, so it should be stable enough to be ported.

moinmoti avatar Jan 22 '22 10:01 moinmoti

Same issue.

feizhanxia avatar Apr 06 '22 02:04 feizhanxia

It doesn't look like anyone is working on this issue. It has persisted onto Julia v1.9 master. Given Apple Silicon has been on the market for over 2 years now and Julia 1.8 and 1.9 support for the arm64 macOS has become much more stable than 1.7, it would be nice to have PlotlyJS be able to save figures on this platform. What's needed to make that happen?

truedichotomy avatar Apr 19 '22 14:04 truedichotomy