# How to create a system image with Makie.jl

**URL:** https://discourse.julialang.org/t/how-to-create-a-system-image-with-makie-jl/55493
**Category:** Visualization
**Tags:** question, makie
**Created:** [February 18, 2021, 12:08am UTC](https://discourse.julialang.org/t/how-to-create-a-system-image-with-makie-jl/55493 "2021-02-18T00:08:50Z")
**Posts on this page:** 9
**Page:** 1

<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: [February 18, 2021, 12:08am UTC](https://discourse.julialang.org/t/how-to-create-a-system-image-with-makie-jl/55493/1 "2021-02-18T00:08:50Z")

</div>

I created a system image containing Makie.jl using the following steps:

```julia
julia --project
]add PackageCompiler
add MakieGallery

exit()
julia --project
using MakieGallery

exit()
julia --project
using Makie
using PackageCompiler

PackageCompiler.create_sysimage(
    :Makie;
    sysimage_path="MakieSys.so",
    precompile_execution_file=joinpath(pkgdir(Makie), "test", "test_for_precompile.jl")
)

```

I launch julia with the command:

```bash
julia -J MakieSys.so --project

```

I execute:

```julia
include("src/KiteViewer.jl")

```

→ works fine

I execute:

```julia
main()

```

and get the following stack trace:

```julia
julia> main()
ERROR: MethodError: no method matching (Button{ArgType} where ArgType)(::Scene; label="RESET")
Closest candidates are:
  (::Type{var"#s199"} where var"#s199"<:AbstractPlot{Typ})(::SceneLike, ::Attributes, ::Any) where Typ at /home/ufechner/.julia/packages/AbstractPlotting/JCbJs/src/interfaces.jl:418 got unsupported keyword argument "label"
  (::Type{var"#s199"} where var"#s199"<:AbstractPlot{Typ})(::SceneLike, ::Attributes, ::Any, ::Any) where Typ at /home/ufechner/.julia/packages/AbstractPlotting/JCbJs/src/interfaces.jl:439 got unsupported keyword argument "label"
  (::Type{var"#s199"} where var"#s199"<:Combined)(::Any, ::Any, ::Any, ::Any, ::Any) at /home/ufechner/.julia/packages/AbstractPlotting/JCbJs/src/interfaces.jl:357 got unsupported keyword argument "label"
Stacktrace:
 [1] main(gl_wait::Bool)
   @ Main ~/repos/KiteViewer/src/KiteViewer.jl:153
 [2] main()
   @ Main ~/repos/KiteViewer/src/KiteViewer.jl:135
 [3] top-level scope
   @ REPL[2]:1

```

If I comment the buttons and the slider in the source code everything works fine.

Any idea?

I am using Julia 1.6 rc1 on Linux 64 bit and the following source code:

> **[GitHub - ufechner7/KiteViewer: 3D viewer and simulator for airborne wind...](https://github.com/ufechner7/KiteViewer)**
>
> 3D viewer and simulator for airborne wind energy systems - GitHub - ufechner7/KiteViewer: 3D viewer and simulator for airborne wind energy systems

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [February 18, 2021, 8:06am UTC](https://discourse.julialang.org/t/how-to-create-a-system-image-with-makie-jl/55493/2 "2021-02-18T08:06:52Z")

</div>

The same code with the exact same package versions you compiled into your image works, if you do it without the sysimage? It’s weird that Button is missing but layoutscene earlier in your code and GridLayout are available. That means MakieLayout is exported somehow without Button, or something else as a side effect of the package compilation.

---

<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: [February 18, 2021, 11:13am UTC](https://discourse.julialang.org/t/how-to-create-a-system-image-with-makie-jl/55493/3 "2021-02-18T11:13:51Z")

</div>

Yes, the same code works without the modified sysimage, but I had to add the lines:

```julia
using AbstractPlotting, AbstractPlotting.MakieLayout

```

when using the sysimage to get rid of messages that some layout related stuff is missing.

In other words: Yes, I think MakieLayout is somehow missing. How can I add it?

---

<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: [February 18, 2021, 11:07pm UTC](https://discourse.julialang.org/t/how-to-create-a-system-image-with-makie-jl/55493/4 "2021-02-18T23:07:46Z")

</div>

I identified the problem. Installing MakieGallery for creating a system image downgraded Makie which made my code fail. See: [How to use a Button in GLMakie](https://discourse.julialang.org/t/how-to-use-a-button-in-glmakie/55583)

No solution yet for the original question, though, because by default it requires MakieGallery.

---

<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: [February 18, 2021, 11:14pm UTC](https://discourse.julialang.org/t/how-to-create-a-system-image-with-makie-jl/55493/5 "2021-02-18T23:14:35Z")

</div>

So we need a replacement for this script:

```julia
ufechner@TUD277255:~$ cat /home/ufechner/.julia/packages/Makie/iTycG/test/test_for_precompile.jl
using MakieGallery, AbstractPlotting, GLMakie, Test

empty!(MakieGallery.plotting_backends)
push!(MakieGallery.plotting_backends, "Makie")
database = MakieGallery.load_database([
                    "tutorials.jl",
                    "attributes.jl",
                    "short_tests.jl"
                    ])

test_record_path = joinpath(@ __DIR__ , "test_recordings")
recordings = MakieGallery.record_examples(test_record_path)
@assert length(recordings) == length(database)
@info "Precompile script has completed execution."

```

I created an issue: [The script test\_for\_precompile.jl is not compatible with the current version of Makie · Issue #845 · JuliaPlots/Makie.jl · GitHub](https://github.com/JuliaPlots/Makie.jl/issues/845)

---

<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: [February 19, 2021, 12:18pm UTC](https://discourse.julialang.org/t/how-to-create-a-system-image-with-makie-jl/55493/6 "2021-02-19T12:18:27Z")

</div>

I created my own test\_for\_precompile.jl script, see [KiteViewer/test\_for\_precompile.jl at main · ufechner7/KiteViewer · GitHub](https://github.com/ufechner7/KiteViewer/blob/main/test/test_for_precompile.jl)

I even created a script create\_sys\_image.sh , see: [KiteViewer/create\_sys\_image.sh at main · ufechner7/KiteViewer · GitHub](https://github.com/ufechner7/KiteViewer/blob/main/create_sys_image.sh) .

This works very well, startup time is reduced from 41s to 4s .

---

<div class="post-metadata">

### Author: ![airpmb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/airpmb/32/7826_2.png) [@airpmb](https://discourse.julialang.org/u/airpmb)
#### Post date: [March 31, 2021, 6:20pm UTC](https://discourse.julialang.org/t/how-to-create-a-system-image-with-makie-jl/55493/7 "2021-03-31T18:20:39Z")

</div>

Thanks, I’m going to borrow this! You include Makie explicitly though; I thought the Makie package itself was basically deprecated and one should just use GLMakie (or CairoMakie, WGLMakie) at this point?

What about AbstractPlotting, should that be mentioned explicitly in the build script?

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [March 31, 2021, 6:50pm UTC](https://discourse.julialang.org/t/how-to-create-a-system-image-with-makie-jl/55493/8 "2021-03-31T18:50:45Z")

</div>

Makie.jl bundled GLMakie.jl and AbstractPlotting.jl before backends reexported AbstractPlotting.  
Therefore, Makie.jl is equivalent to GLMakie.jl now, except it tends to fall behind on compat bounds and is only dragged along for compatibility.

All backends have AbstractPlotting as a dependency anyway, so you can’t avoid it.

---

<div class="post-metadata">

### Author: ![mariusd](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mariusd/32/23231_2.png) [@mariusd](https://discourse.julialang.org/u/mariusd)
#### Post date: [September 17, 2021, 2:17pm UTC](https://discourse.julialang.org/t/how-to-create-a-system-image-with-makie-jl/55493/9 "2021-09-17T14:17:10Z")

</div>

Creating the sysimage itself is also very slow, at least in my case. I think we also need a sysimage for the PackageCompiler itself 😀.
