Makie GLFWError

I am attempting to use Makie for the first time but I am getting the following error:

ERROR: GLFWError (VERSION_UNAVAILABLE): GLX: Failed to create context: BadValue

I have tried to run some of the Makie examples and a minimal example consisting of just:

using Makie
scene = Scene()

I am running:
Ubuntu 18.04.5
Makie v0.11.1
julia-1.5.3 (same result with julia-1.5.2)

Here is the full stack trace:

Error showing value of type Scene:
ERROR: GLFWError (VERSION_UNAVAILABLE): GLX: Failed to create context: BadValue
Stacktrace:
 [1] _ErrorCallbackWrapper(::Int32, ::Cstring) at /home/arnie/.julia/packages/GLFW/CBo9c/src/callback.jl:43
 [2] CreateWindow(::Int64, ::Int64, ::String, ::GLFW.Monitor, ::GLFW.Window) at /home/arnie/.julia/packages/GLFW/CBo9c/src/glfw3.jl:499
 [3] GLFW.Window(; name::String, resolution::Tuple{Int64,Int64}, debugging::Bool, major::Int64, minor::Int64, windowhints::Array{Tuple{UInt32,Integer},1}, contexthints::Array{Tuple{UInt32,Integer},1}, visible::Bool, focus::Bool, fullscreen::Bool, monitor::Nothing, share::GLFW.Window) at /home/arnie/.julia/packages/GLFW/CBo9c/src/glfw3.jl:344
 [4] GLMakie.Screen(; resolution::Tuple{Int64,Int64}, visible::Bool, title::String, kw_args::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/arnie/.julia/packages/GLMakie/Pway1/src/screen.jl:317
 [5] Screen at /home/arnie/.julia/packages/GLMakie/Pway1/src/screen.jl:291 [inlined]
 [6] global_gl_screen at /home/arnie/.julia/packages/GLMakie/Pway1/src/screen.jl:363 [inlined]
 [7] global_gl_screen(::Tuple{Int64,Int64}, ::Bool, ::Int64) at /home/arnie/.julia/packages/GLMakie/Pway1/src/screen.jl:373
 [8] global_gl_screen at /home/arnie/.julia/packages/GLMakie/Pway1/src/screen.jl:372 [inlined]
 [9] backend_display at /home/arnie/.julia/packages/GLMakie/Pway1/src/gl_backend.jl:57 [inlined]
 [10] display(::AbstractPlotting.PlotDisplay, ::Scene) at /home/arnie/.julia/packages/AbstractPlotting/JCbJs/src/display.jl:45
 [11] display(::Any) at ./multimedia.jl:328
 [12] #invokelatest#1 at ./essentials.jl:710 [inlined]
 [13] invokelatest at ./essentials.jl:709 [inlined]
 [14] print_response(::IO, ::Any, ::Bool, ::Bool, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:238
 [15] print_response(::REPL.AbstractREPL, ::Any, ::Bool, ::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:223
 [16] (::REPL.var"#do_respond#54"{Bool,Bool,REPL.var"#64#73"{REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:822
 [17] #invokelatest#1 at ./essentials.jl:710 [inlined]
 [18] invokelatest at ./essentials.jl:709 [inlined]
 [19] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/LineEdit.jl:2355
 [20] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:1144
 [21] (::REPL.var"#38#42"{REPL.LineEditREPL,REPL.REPLBackendRef})() at ./task.jl:356

Problem solved: I updated my display driver (Nvidia) and I am now in business.

I get this error often with the version of julia downloaded from the website. But if I build it myself from source it works like a charm. Never could figure out why it cannot find the right drivers with the downloaded precompiled tar archive.

3 Likes
2 Likes

Can confirm @giordano’s link fixed the issue for me. I just had to do something like the following:

in bash:
export LD_PRELOAD=/lib/x86_64-linux-gnu/libstdc++.so.6
Note: find your own path with something like: /sbin/ldconfig -p | grep stdc++

in julia:

ENV["DISPLAY"] = ":0"
using GLFW
...

Thanks Mose!

1 Like

Also you can set this in your VSCode until 1.6 rolls around(bug is fixed there) by editing your settings.json like the following:

    "terminal.integrated.env.linux": {
        "LD_PRELOAD": "/lib/x86_64-linux-gnu/libstdc++.so.6"
    },

(thanks @pfitzseb)

Awesome, thanks @giordano!

1 Like