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

Error with relocatability

Open guilhermebodin opened this issue 10 months ago • 1 comments

Hello,

we have embedded PlotlyLight into a compiled Julia application but it is facing some weird relocatability issues.

SystemError: opening file "/root/.julia/artifacts/aa67a2d0c294419c5568a236d0fdf8de18af2bd6/templates/plotly_white.json": No such file or directory
Stacktrace:
  [1] systemerror(?::String, ?::Int32; ?::Nothing)
    @ Base ./<missing>:0
  [2] open(?::String; ?::Bool, ?::Nothing, ?::Nothing, ?::Nothing, ?::Nothing, ?::Nothing)
    @ Base ./<missing>:0
  [3] open(?::Base.var"#470#471"{Tuple{}}, ?::String; ?::@Kwargs{})
    @ Base ./<missing>:0
  [4] template!(?::String)
    @ PlotlyLight ~/.julia/packages/PlotlyLight/DpYsf/src/PlotlyLight.jl:168
  [5] _set_plot_defaults
    @ /model_build/IARA.jl/src/plots/plots.jl:105 [inlined]
  [6] initialize
    @ /model_build/IARA.jl/src/IARA.jl:44 [inlined]
  [7] main(?::IARA.Args)
    @ IARA.InterfaceCalls /model_build/IARA.jl/src/interface_calls/main.jl:23
  [8] main
    @ /model_build/IARA.jl/src/interface_calls/main.jl:18 [inlined]
  [9] julia_interface_call()
    @ IARA /model_build/IARA.jl/src/main.jl:59
 [10] top-level scope
    @ none:1root@3efb74253c79:/IARA#

The path /.root/.julia./... comes from the machine where the application was compiled.

Although through investigation it seems that everything is relocatable I am afraid that the definition of plotly::PlotlyArtifacts = PlotlyArtifacts() in the main file of the module gets compiled at that moment of compilation and gets saved in the system image.

Is it possible to check or modify this in runtime?

guilhermebodin avatar Jan 29 '25 14:01 guilhermebodin

Ah, yeah that should be inside an __init__ function. A quick workaround is setting it yourself (untested):

PlotlyLight.plotly = PlotlyLight.PlotlyArtifacts(path="path/to/plotly.js")

joshday avatar Jan 29 '25 19:01 joshday