Sysimage creation example with plots does not seem to work

The example given in Creating a sysimage for fast plotting with Plots.jl · PackageCompiler does not finish after more than 25 minutes.

I am running Julia 1.9.2 under Debian Linux. This is what I have done:

  1. Create file precompile_plots.jl that contains
using Plots
p = plot(rand(2,2))
display(p)
  1. Start julia as follows:
    julia --history-file=no --startup-file=no

  2. Run the code as shown in the example:

using PackageCompiler
create_sysimage(["Plots"], sysimage_path="sys_plots.so", precompile_execution_file="precompile_plots.jl")
  1. I’ve also tried
using PackageCompiler
create_sysimage(:Plots, sysimage_path="sys_plots.so", precompile_execution_file="precompile_plots.jl")

and

  1. (note I use “;”, not “,” after ["Plots"])
using PackageCompiler
create_sysimage(["Plots"]; sysimage_path="sys_plots.so", precompile_execution_file="precompile_plots.jl")

After more than 45 minutes, none of the above invocations are done, and they show PackageCompiler: compiling incremental system image. Note that, in contrast to the above, the example in Creating a sysimage with OhMyREPL · PackageCompiler finishes (in 4’ 26").

I’ve also created other sysimages, that do not use Plots, and they are created. Is anybody else experiencing similar problems? Any workaround?

EDIT: similar problems have been reported in the repo for PackageCompiler: PackageCompiler spins infinitely when compiling sysimage · Issue #825 · JuliaLang/PackageCompiler.jl · GitHub . Moving additional comments there.

My suggestion: Just don’t add Plots to the system image. First time to plot is pretty fast with Julia 1.9 even without doing this. Doing a “persistant backend selection” (see: Backends · Plots) also helps to reduce the time to first plot.

I use a custom sysimage on a daily basis, and I added everything but Plots and PythonPlot…

Thanks. I am rewriting the code for my two or three sysimages removing Plots from them. And I didn’t know about “persistant backend selection”: thank you for pointing that out.

That said, however, I think either there is a bug in create_sysimage or the documentation should be changed, or both.