# GitHub throws errors when precompiling GLMakie

**URL:** <https://discourse.julialang.org/t/github-throws-errors-when-precompiling-glmakie/101882>\
**Category:** Visualization\
**Tags:** question\
**Created:** [July 21, 2023, 10:52am UTC](https://discourse.julialang.org/t/github-throws-errors-when-precompiling-glmakie/101882 "2023-07-21T10:52:25Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Niall](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niall/32/22517_2.png) [@Niall](https://discourse.julialang.org/u/Niall)\
**Post date:** [July 21, 2023, 10:52am UTC](https://discourse.julialang.org/t/github-throws-errors-when-precompiling-glmakie/101882/1 "2023-07-21T10:52:25Z")

</div>

Hi. I’m having endless problems getting Makie to precompile successfully on GitHub in a package whose code I have inherited, but which compiles fine on my own machine. In particular, GitHub gives me these warnings from followed by the error at the end:

```julia
WARNING: Makie.MakieLayout is deprecatedThe module `MakieLayout` has been removed and integrated into Makie, so simply replace all usage of `MakieLayout` with `Makie`.
  likely near none:1
WARNING: importing deprecated binding Makie.MakieLayout into GLMakie.
WARNING: Makie._alternative_fonts is deprecated, use ALTERNATIVE_FONTS instead.
  likely near none:1
WARNING: importing deprecated binding Makie._alternative_fonts into GLMakie.

... bla-bla-bla ...

WARNING: Makie.minimal_default is deprecated, use MAKIE_DEFAULT_THEME instead.
  likely near none:1
WARNING: importing deprecated binding Makie.minimal_default into GLMakie.
┌ Warning: OpenGL/GLFW wasn't loaded correctly or couldn't be initialized.
│ This likely means, you're on a headless server without having OpenGL support setup correctly.
│ Have a look at the troubleshooting section in the readme:
│ https://github.com/MakieOrg/Makie.jl/tree/master/GLMakie#troubleshooting-opengl.
└ @ GLMakie ~/.julia/packages/GLMakie/OVxAi/src/gl_backend.jl:4
ERROR: LoadError: InitError: Exception[GLFW.GLFWError(GLFW.PLATFORM_ERROR, "X11: The DISPLAY environment variable is missing"), ErrorException("glfwInit failed")]

```

I gather the final error means I should define an environment variable “:DISPLAY=0”, but surely I don’t have that access to the compile environment on GitHub. Can anyone please help? Thanks!

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [July 21, 2023, 11:23am UTC](https://discourse.julialang.org/t/github-throws-errors-when-precompiling-glmakie/101882/2 "2023-07-21T11:23:28Z")

</div>

I guess you shouldn’t use GLMakie on a cloud instance without a GPU.  
Can you swap with CairoMakie/WGLMakie ?

---

<div class="post-metadata">

**Author:** ![Niall](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niall/32/22517_2.png) [@Niall](https://discourse.julialang.org/u/Niall)\
**Post date:** [July 21, 2023, 11:42am UTC](https://discourse.julialang.org/t/github-throws-errors-when-precompiling-glmakie/101882/3 "2023-07-21T11:42:37Z")

</div>

Thanks very much, but I’m not sure that can be the issue. I use GLMakie because I need to create animations, and I do that successfully in other packages without getting these errors during GitHub precompilation. Am I right in assuming that I need GLMakie rather than Cairo if I want to animate?

As far as WGLMakie is concerned, it seems that is for web-based applications, which is again not what I’m doing.

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [July 21, 2023, 11:49am UTC](https://discourse.julialang.org/t/github-throws-errors-when-precompiling-glmakie/101882/4 "2023-07-21T11:49:26Z")

</div>

What do you mean by github precompilation anyways?  
You can also do animations with CairoMakie!  
It just doesn’t open an interactive window right now.  
If you still need GLMakie, have a look at:  
[https://docs.makie.org/stable/documentation/backends/glmakie/index.html#troubleshooting\_opengl](https://docs.makie.org/stable/documentation/backends/glmakie/index.html#troubleshooting_opengl)

---

<div class="post-metadata">

**Author:** ![Niall](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niall/32/22517_2.png) [@Niall](https://discourse.julialang.org/u/Niall)\
**Post date:** [July 21, 2023, 12:23pm UTC](https://discourse.julialang.org/t/github-throws-errors-when-precompiling-glmakie/101882/5 "2023-07-21T12:23:59Z")

</div>

OK, I’ll have to be careful here, since it seems there is so much I don’t understand that I might easily say something stupid. I do indeed need an interactive panel - I’m using InteractiveDynamics with the Agents package - so I assume that I need GLMakie.

I don’t have much experience of creating projects on GitHub, so I can well imagine that I’m missing something basic, but each time I commit a change to another package of mine, GitHub runs three tests: julia 1.0, julia 1.9 and julia nightly. This other package also uses GLMakie with InteractiveDynamics and Agents, and I’m used to the julia 1.0 test failing, but the others pass ok. Now, with this new package (which as I say, I’ve inherited, so I’m unsure of all the code), I’m getting all three tests failing, but I can’t work out why.

I’m sorry it’s all a bit vague, but I’m rather unsure of myself, and the code is too big to condense it into a conveniently small demonstration example.

---

<div class="post-metadata">

**Author:** ![mattderstine](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattderstine/32/31168_2.png) [@mattderstine](https://discourse.julialang.org/u/mattderstine)\
**Post date:** [July 29, 2023, 5:21pm UTC](https://discourse.julialang.org/t/github-throws-errors-when-precompiling-glmakie/101882/6 "2023-07-29T17:21:45Z")

</div>

I’m having the same issue as I’m new with packages and get the same errors. The issue is that when Github tries to run the tests created by PkgTemplates which include precompiling GLMakie, it throws an error because it can’t initialize GLMakie. This is the same error @Niall is showing.  
So the question is: how does one let GitHub run tests for a package under development that uses GLMakie but doesn’t actually test the parts that use it?

---

<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:** [July 29, 2023, 7:02pm UTC](https://discourse.julialang.org/t/github-throws-errors-when-precompiling-glmakie/101882/7 "2023-07-29T19:02:20Z")

</div>

The important part in GLMakie’s CI setup is this line which installs tools to run a software OpenGL driver: [https://github.com/MakieOrg/Makie.jl/blob/master/.github/workflows/glmakie.yaml#L47](https://github.com/MakieOrg/Makie.jl/blob/master/.github/workflows/glmakie.yaml#L47) and this line which runs the tests within the `xvfb` or X virtual framebuffer program [https://github.com/MakieOrg/Makie.jl/blob/master/.github/workflows/glmakie.yaml#L58](https://github.com/MakieOrg/Makie.jl/blob/master/.github/workflows/glmakie.yaml#L58). This allows you to run GLMakie without a real GPU

---

<div class="post-metadata">

**Author:** ![mattderstine](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattderstine/32/31168_2.png) [@mattderstine](https://discourse.julialang.org/u/mattderstine)\
**Post date:** [July 30, 2023, 5:52pm UTC](https://discourse.julialang.org/t/github-throws-errors-when-precompiling-glmakie/101882/8 "2023-07-30T17:52:10Z")

</div>

This is quite helpful. I need to learn how to use CI so I can set this up for my package. This helps letting me know what I need to learn and why. It’s a much better answer than just fixing my problem. Thanks!

---

<div class="post-metadata">

**Author:** ![Niall](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niall/32/22517_2.png) [@Niall](https://discourse.julialang.org/u/Niall)\
**Post date:** [July 31, 2023, 9:56am UTC](https://discourse.julialang.org/t/github-throws-errors-when-precompiling-glmakie/101882/9 "2023-07-31T09:56:01Z")

</div>

Many thanks, @jules - I agree with @mattderstine that this is a really helpful answer. I’m just not quite as far has he seems to be, because I’m unsure how to incorporate the lines into my code. Do I simply copy the glmakie.yaml file across to my workflows folder, or do incorporate the relevant lines into my CompatHelper.yml file? Or something else?

---

<div class="post-metadata">

**Author:** ![mattderstine](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattderstine/32/31168_2.png) [@mattderstine](https://discourse.julialang.org/u/mattderstine)\
**Post date:** [July 31, 2023, 8:04pm UTC](https://discourse.julialang.org/t/github-throws-errors-when-precompiling-glmakie/101882/10 "2023-07-31T20:04:11Z")

</div>

@Niall, Here is my CI.yml file. The key lines for us are the last 2. If you add these you should be good to go. I also learned from the GLMakie file to narrow the different Julia version numbers that run each time.

```julia
name: CI
on:
  push:
    branches:
      - main
    tags: ['*']
  pull_request:
concurrency:
  # Skip intermediate builds: always.
  # Cancel intermediate builds: only if it is a pull request build.
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
  test:
    name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        version:
          - '1'
        os:
          - ubuntu-latest
        arch:
          - x64
    steps:
      - uses: actions/checkout@v3
      - uses: julia-actions/setup-julia@v1
        with:
          version: ${{ matrix.version }}
          arch: ${{ matrix.arch }}
      - uses: julia-actions/cache@v1
      - uses: julia-actions/julia-buildpkg@v1
      - uses: julia-actions/julia-runtest@v1
        with:
          prefix: xvfb-run -s '-screen 0 1024x768x24'

```

---

<div class="post-metadata">

**Author:** ![Niall](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niall/32/22517_2.png) [@Niall](https://discourse.julialang.org/u/Niall)\
**Post date:** [August 2, 2023, 8:19am UTC](https://discourse.julialang.org/t/github-throws-errors-when-precompiling-glmakie/101882/11 "2023-08-02T08:19:07Z")

</div>

Thanks Matt - that’s wonderful. Everything’s gone through just fine, and as you say, the issues with the julia versions are an added bonus. 😃

Best wishes,  
Niall.
