Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Using PackageCompiler with Plots fails for newer versions of Plots #4664

Open
ufechner7 opened this issue Feb 12, 2023 · 6 comments
Open
Labels

Comments

@ufechner7
Copy link

ufechner7 commented Feb 12, 2023

julia> versioninfo()
Julia Version 1.8.5
Commit 17cfb8e65ea (2023-01-08 06:45 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
  Threads: 1 on 8 virtual cores

Test script:

using Plots
p = plot(rand(2,2))
display(p)

Commands to create system image:

using PackageCompiler
create_sysimage(["Plots"], sysimage_path="sys_plots.so", precompile_execution_file="precompile_plots.jl")

If I now launch julia with:

julia -J sys_plots.so --project

and then try to create a plot with:

using Plots
p = plot(rand(2,2))
display(p)

I get the following text output:

Plot{Plots.GRBackend() n=2}

But no plot window is popping up.

This bug is present with the following packages:

(Bug) pkg> st
Status `~/repos/Bug/Project.toml`
  [28b8d3ca] GR v0.71.6
  [9b87118b] PackageCompiler v2.1.5
  [91a5bcdd] Plots v1.38.5

But disappears if I downgrade Plots.jl to version v1.36.6.

Releated bug: JuliaLang/PackageCompiler.jl#786

@ufechner7 ufechner7 added the bug label Feb 12, 2023
@t-bltg
Copy link
Member

t-bltg commented Feb 12, 2023

What does gui(p) report ?

From the looks of it, if 1.36.6 worked, it might be an effect of #4566, which got introduced in 1.37.0.

Also, please report:

julia> Plots.PlotsDisplay() in Base.Multimedia.displays
true

@ufechner7
Copy link
Author

gui(p) is actually displaying the plot.

julia> Plots.PlotsDisplay() in Base.Multimedia.displays
true

@t-bltg
Copy link
Member

t-bltg commented Feb 12, 2023

It seems that the position of PlotsDisplay in Base.Multimedia.displays might be faulty in your case (see https://github.com/JuliaPlots/Plots.jl/blob/master/src/init.jl#L36-L55).

From Base.display docs:

Display x using the topmost applicable display in the display stack, typically using the richest supported multimedia output for x, with plain-text [stdout](https://docs.julialang.org/en/v1/base/io-network/#Base.stdout) output as a fallback.

You might want to play with inserting PlotsDisplay in Base.Multimedia.displays, or maybe running Plots.__init__() would work in your case.

At least, you have a workaround using gui or you could define: Base.display(plt::Plots.Plot) = Plots.gui(plt) as a workaround.

But honestly I don't think we will be working on a fix since this is PackageCompiler related, and we never supported this kind of usage ...

@ufechner7
Copy link
Author

ufechner7 commented Feb 12, 2023

I had a similar problem with Bokeh.jl which was fixed pretty fast: cjdoris/Bokeh.jl#19

And I think it would be nice if the use of Plots with PackageCompiler would be supported, I think a lot of people use them together...

@t-bltg
Copy link
Member

t-bltg commented Feb 12, 2023

Well, if you got a fix for that, make a PR :)

@ufechner7
Copy link
Author

ufechner7 commented Feb 12, 2023

Workaround:

using Plots
Plots.__init__()

p = plot(rand(2,2))
display(p)

Call Plots.__init__() after "using Plots"...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants