# Sysimage creation example with plots does not seem to work

**URL:** https://discourse.julialang.org/t/sysimage-creation-example-with-plots-does-not-seem-to-work/101269
**Category:** General Usage
**Tags:** plots, sysimage
**Created:** [July 6, 2023, 4:17pm UTC](https://discourse.julialang.org/t/sysimage-creation-example-with-plots-does-not-seem-to-work/101269 "2023-07-06T16:17:08Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![rdiaz02](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@rdiaz02](https://discourse.julialang.org/u/rdiaz02)
#### Post date: [July 6, 2023, 4:17pm UTC](https://discourse.julialang.org/t/sysimage-creation-example-with-plots-does-not-seem-to-work/101269/1 "2023-07-06T16:17:08Z")

</div>

The example given in [Creating a sysimage for fast plotting with Plots.jl · PackageCompiler](https://julialang.github.io/PackageCompiler.jl/dev/examples/plots.html) 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

```julia
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:

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

```

1. I’ve also tried

```julia
using PackageCompiler
create_sysimage(:Plots, sysimage_path="sys_plots.so", precompile_execution_file="precompile_plots.jl")

```

and

1. (note I use “;”, not “,” after `["Plots"]`)

```julia
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](https://julialang.github.io/PackageCompiler.jl/dev/examples/ohmyrepl.html) 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](https://github.com/JuliaLang/PackageCompiler.jl/issues/825) . Moving additional comments there.

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [July 6, 2023, 6:45pm UTC](https://discourse.julialang.org/t/sysimage-creation-example-with-plots-does-not-seem-to-work/101269/2 "2023-07-06T18:45:44Z")

</div>

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](https://docs.juliaplots.org/latest/backends/)) 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…

---

<div class="post-metadata">

### Author: ![rdiaz02](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@rdiaz02](https://discourse.julialang.org/u/rdiaz02)
#### Post date: [July 6, 2023, 7:10pm UTC](https://discourse.julialang.org/t/sysimage-creation-example-with-plots-does-not-seem-to-work/101269/3 "2023-07-06T19:10:44Z")

</div>

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.
