JuliaPlots / PlotlyJS.jl

Julia library for plotting with plotly.js
Other
424 stars 78 forks source link

Errors on importing PlotlyJS after fresh install on nightly Julia #363

Closed robsmith11 closed 1 year ago

robsmith11 commented 3 years ago

If I call import/using a second time, there is no error and I can use PlotlyJS fine.

(@v1.7) pkg> status
      Status `~/.julia/environments/v1.7/Project.toml`
  [f0f68f2c] PlotlyJS v0.14.0

julia> versioninfo()
Julia Version 1.7.0-DEV.383
Commit bf15b706e9* (2021-01-26 04:39 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: AMD Ryzen 7 4700U with Radeon Graphics
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, znver2)
ERROR: InitError: SystemError: opening file "/home/me/.julia/packages/PlotlyJS/m2Lzd/deps/build.log": No such file or directory
Stacktrace:
  [1] systemerror(p::String, errno::Int32; extrainfo::Nothing)
    @ Base ./error.jl:168
  [2] #systemerror#66
    @ ./error.jl:167 [inlined]
  [3] systemerror
    @ ./error.jl:167 [inlined]
  [4] open(fname::String; lock::Bool, read::Nothing, write::Nothing, create::Nothing, truncate::Nothing, append::Nothing)
    @ Base ./iostream.jl:293
  [5] open
    @ ./iostream.jl:282 [inlined]
  [6] open(f::Base.var"#354#355"{String}, args::String; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base ./io.jl:328
  [7] open
    @ ./io.jl:328 [inlined]
  [8] read
    @ ./io.jl:435 [inlined]
  [9] __init__()
    @ PlotlyJS ~/.julia/packages/PlotlyJS/m2Lzd/src/PlotlyJS.jl:65
 [10] _include_from_serialized(path::String, depmods::Vector{Any})
    @ Base ./loading.jl:670
 [11] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base ./loading.jl:756
 [12] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:994
 [13] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:910
 [14] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:897
during initialization of module PlotlyJS
sglyon commented 3 years ago

Thanks @robsmith11

I'm not working on nightly right now, so I don't think I'll be able to contribute a fix.

That being said, I'm happy to review a PR if someone who does work on nightly is willing to tackle this one

jkrimmer commented 3 years ago

I am encountering the same issue on 1.6.0-rc1. However, the generated plots are not displayed in the Blink window. @robsmith11 Are you able to reproduce this issue on the nightly build as well? Anyway, I will try to dig deeper to ensure compatibility with the new release as soon as possible :)

EDIT: Okay, I have found the culprit much sooner than expected. The __init__() function, which is executed each time we are using PlotlyJS, looks for a file called "build.log" in joinpath(_pkg_root, "deps", "build.log"). If this file cannot be found, the initialization fails. Apparently, the source directory of the PlotlyJS package is not writeable on julia 1.6.0-rc1 (Windows 10) and above due to some change in the permission handling. Hence, there exists no such "build.log" file in the deps-directory.

To my understanding, there is now the scratch spaces API which places files such as logfiles (which usually do not have to be accessed by the user with a file browser) in a a package-specific mutable directory.

robsmith11 commented 3 years ago

Thanks for looking into it more, @jonas-kr. I've always just exported the plot to a html file and viewed it in Firefox, so I've never tried using Blink, but it's likely broken here too.

sglyon commented 3 years ago

@jonas-kr I don't know much about this scratch spaces api

Is this something you could help us integrate here?

jkrimmer commented 3 years ago

Honestly, I do not know anything about this api, yet. However, I will try to look into this.

ericphanson commented 3 years ago

It looks to me like this was fixed (or at least worked-around) in https://github.com/JuliaPlots/PlotlyJS.jl/commit/c4418ccc2537d1954913af351da9fbd71a55175b, there just hasn't been a release since then

jkrimmer commented 3 years ago

@ericphanson Thanks a lot for this hint, this commit does provide a workaround for the issue. Actually, building the package on an 1.6.0-rc3 build creates an (in my case empty) build.log file in a subdirectory of .julia/scratchspaces. Hence, it seems like the only thing that remains to be fixed is the path of this build.log file. I will try to resolve this issue asap.

sglyon commented 3 years ago

I did just release a fresh version of plotlyJS in response to @ericphanson comment (thanks for the reminder!)

Hopefully things work on latest release of this package