GitHub throws errors when precompiling GLMakie

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:

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:
└ @ 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!

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

1 Like

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.

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:

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.

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?

The important part in GLMakie’s CI setup is this line which installs tools to run a software OpenGL driver: and this line which runs the tests within the xvfb or X virtual framebuffer program This allows you to run GLMakie without a real GPU

1 Like

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!

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?

@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.

name: CI
      - main
    tags: ['*']
  # 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/') }}
    name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
    runs-on: ${{ matrix.os }}
      fail-fast: false
          - '1'
          - ubuntu-latest
          - x64
      - uses: actions/checkout@v3
      - uses: julia-actions/setup-julia@v1
          version: ${{ matrix.version }}
          arch: ${{ matrix.arch }}
      - uses: julia-actions/cache@v1
      - uses: julia-actions/julia-buildpkg@v1
      - uses: julia-actions/julia-runtest@v1
          prefix: xvfb-run -s '-screen 0 1024x768x24'

1 Like

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. :smiley:

Best wishes,