Search code examples
juliamakie.jl

How to solve the GLMakie Precompiling error in Julia?


I was plotting my heatmap using Makie. It was working fine but suddenly I get this error trying to run the GLMakie package. CairoMakie worked fine.

using GLMakie 

[ Info:  [e9467ef8-e4e7-5192-8a1a-b1aee30e663a]  ERROR: LoadError: KeyError: key :colormap not found
Stacktrace:
  [1] getindex(h::Dict{Symbol, Observables.Observable}, key::Symbol)
    @ Base ./dict.jl:481
  [2] getindex
    @ ~/.julia/packages/MakieCore/8YGMv/src/attributes.jl:96 [inlined]
  [3] getindex(x::MakieCore.Mesh{Tuple{GeometryBasics.Mesh{2, Float32, GeometryBasics.Ngon{2, Float32, 3, GeometryBasics.Point{2, Float32}}, GeometryBasics.SimpleFaceView{2, Float32, 3, GeometryBasics.OffsetInteger{-1, UInt32}, GeometryBasics.Point{2, Float32}, GeometryBasics.NgonFace{3, GeometryBasics.OffsetInteger{-1, UInt32}}}}}}, key::Symbol)
    @ MakieCore ~/.julia/packages/MakieCore/8YGMv/src/attributes.jl:192

*<skipping abundant error messages>*

ERROR: Failed to precompile GLMakie [e9467ef8-e4e7-5192-8a1a-b1aee30e663a] to /home/mikheev/.julia/compiled/v1.7/GLMakie/jl_OWtvbO.

while my heatmap code gave me this error:

let

    ix = sortperm([a[1] for a in argmax(dat_e[28,:,:], dims=1)][1,:])                                                                           
    ix = ix[2000:6000]
    f, ax, hm = CairoMakie.heatmap((dat_e[28,:,ix]), colormap=Reverse("RdBu"), colorrange = (-40, 40))
   ax = current_axis()
    ax.xlabel = "Time [sec]"
    ax.ylabel = "Sorted trials"
    CairoMakie.Colorbar(f[:, end+1], hm, label = "Voltage [µV]") 
    hidespines!(ax, :t, :r) 
    f
end


MethodError: no method matching to_color(::MakieCore.Automatic)
Closest candidates are:
  to_color(!Matched::Number) at ~/.julia/packages/Makie/bwZTV/src/conversions.jl:763
  to_color(!Matched::Colorant) at ~/.julia/packages/Makie/bwZTV/src/conversions.jl:764
  to_color(!Matched::Makie.AbstractPattern) at ~/.julia/packages/Makie/bwZTV/src/conversions.jl:769

Any ideas how to solve it? Both problems occured simultaneously after I restarted my VSCode.


Solution

  • Pkg.update() solved the problem.

    The problem was in the outdated version of the GLMakie.