# \`using Plots\` errors (\`ERROR: LoadError: InitError: UndefVarError: \`GR\_jll\` not defined\`)

**URL:** <https://discourse.julialang.org/t/using-plots-errors-error-loaderror-initerror-undefvarerror-gr-jll-not-defined/113742>\
**Category:** General Usage\
**Tags:** plots\
**Created:** [May 2, 2024, 2:16pm UTC](https://discourse.julialang.org/t/using-plots-errors-error-loaderror-initerror-undefvarerror-gr-jll-not-defined/113742 "2024-05-02T14:16:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Torkel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/torkel/32/5030_2.png) [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Post date:** [May 2, 2024, 2:16pm UTC](https://discourse.julialang.org/t/using-plots-errors-error-loaderror-initerror-undefvarerror-gr-jll-not-defined/113742/1 "2024-05-02T14:16:33Z")

</div>

Yesterday I was helping a friend instal Julia. It was a mac computer, and we installed Julia from scratch using juliaup. We added a like 4 packages, including Plots. When we tried

```julia
using Plots

```

we got an error (see end).

I tried for a really long time to figure out what went wrong, trying on both Julia version 1.10.2 and 1.10.3. Tried restarting Julia and the computer. All various Pkg command (instantiate, resolve, build, update etc.). I tried installing and/or building GR directly (same issue when running `using GR`). I also did some searching and e.g. all the things that went on here: [Plots, InitError: UndefVarError: GR\_jll not defined - #3 by mkitti](https://discourse.julialang.org/t/plots-initerror-undefvarerror-gr-jll-not-defined/102448/3). I am really confused only. We didn’t do anything strange and I see no reason this should be able to fail.

My friend left last night (short visit only) and will probably just go back to Matlab. However, given the really mundane situation (I bet tons of people are using Plots.jl…) it seems like many people have this issue. Hence, I figured I’d raise an issue, in case someone knows how to solve it, that ways others might get help when they search for it.

```julia
julia> using Plots
Precompiling Plots
        Info Given Plots was explicitly requested, output will be shown live 
ERROR: LoadError: InitError: UndefVarError: `GR_jll` not defined
Stacktrace:
  [1] __init__ ()
    @ GR.GRPreferences ~/.julia/packages/GR/SdanO/src/preferences.jl:64
  [2] run_module_init(mod::Module, i::Int64)
    @ Base ./loading.jl:1134
  [3] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1122
  [4] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})
    @ Base ./loading.jl:1067
  [5] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128)
    @ Base ./loading.jl:1581
  [6] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:1938
  [7] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1812
  [8] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
  [9] invoke_in_world
    @ ./essentials.jl:923 [inlined]
 [10] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1803
 [11] macro expansion
    @ ./loading.jl:1790 [inlined]
 [12] macro expansion
    @ ./lock.jl:267 [inlined]
 [13] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1753
 [14] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
 [15] invoke_in_world
    @ ./essentials.jl:923 [inlined]
 [16] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1746
 [17] top-level scope
    @ ~/.julia/packages/Plots/ju9dp/src/backends.jl:380
 [18] eval
    @ ./boot.jl:385 [inlined]
 [19] _initialize_backend(pkg::Plots.GRBackend)
    @ Plots ~/.julia/packages/Plots/ju9dp/src/backends.jl:379
 [20] backend(pkg::Plots.GRBackend)
    @ Plots ~/.julia/packages/Plots/ju9dp/src/backends.jl:244
 [21] backend(sym::Symbol)
    @ Plots ~/.julia/packages/Plots/ju9dp/src/backends.jl:254
 [22] load_default_backend()
    @ Plots ~/.julia/packages/Plots/ju9dp/src/backends.jl:201
 [23] backend()
    @ Plots ~/.julia/packages/Plots/ju9dp/src/backends.jl:232
 [24] top-level scope
    @ ~/.julia/packages/Plots/ju9dp/src/init.jl:108
 [25] include(mod::Module, _path::String)
    @ Base ./Base.jl:495
 [26] include(x::String)
    @ Plots ~/.julia/packages/Plots/ju9dp/src/Plots.jl:1
 [27] top-level scope
    @ ~/.julia/packages/Plots/ju9dp/src/Plots.jl:176
 [28] include
    @ ./Base.jl:495 [inlined]
 [29] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
    @ Base ./loading.jl:2222
 [30] top-level scope
    @ stdin:3
during initialization of module GRPreferences
in expression starting at /Users/chris/.julia/packages/Plots/ju9dp/src/init.jl:108
in expression starting at /Users/chris/.julia/packages/Plots/ju9dp/src/Plots.jl:1
in expression starting at stdin:3
  ✗ GR_jll
  ✗ Plots
  ✗ Plots → UnitfulExt
  0 dependencies successfully precompiled in 18 seconds. 154 already precompiled.

ERROR: The following 1 direct dependency failed to precompile:

Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]

Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to "/Users/chris/.julia/compiled/v1.10/Plots/jl_b4mlJe".
ERROR: LoadError: InitError: UndefVarError: `GR_jll` not defined
Stacktrace:
  [1] __init__ ()
    @ GR.GRPreferences ~/.julia/packages/GR/SdanO/src/preferences.jl:64
  [2] run_module_init(mod::Module, i::Int64)
    @ Base ./loading.jl:1134
  [3] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1122
  [4] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})
    @ Base ./loading.jl:1067
  [5] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128)
    @ Base ./loading.jl:1581
  [6] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:1938
  [7] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1812
  [8] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
  [9] invoke_in_world
    @ ./essentials.jl:923 [inlined]
 [10] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1803
 [11] macro expansion
    @ ./loading.jl:1790 [inlined]
 [12] macro expansion
    @ ./lock.jl:267 [inlined]
 [13] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1753
 [14] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
 [15] invoke_in_world
    @ ./essentials.jl:923 [inlined]
 [16] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1746
 [17] top-level scope
    @ ~/.julia/packages/Plots/ju9dp/src/backends.jl:380
 [18] eval
    @ ./boot.jl:385 [inlined]
 [19] _initialize_backend(pkg::Plots.GRBackend)
    @ Plots ~/.julia/packages/Plots/ju9dp/src/backends.jl:379
 [20] backend(pkg::Plots.GRBackend)
    @ Plots ~/.julia/packages/Plots/ju9dp/src/backends.jl:244
 [21] backend(sym::Symbol)
    @ Plots ~/.julia/packages/Plots/ju9dp/src/backends.jl:254
 [22] load_default_backend()
    @ Plots ~/.julia/packages/Plots/ju9dp/src/backends.jl:201
 [23] backend()
    @ Plots ~/.julia/packages/Plots/ju9dp/src/backends.jl:232
 [24] top-level scope
    @ ~/.julia/packages/Plots/ju9dp/src/init.jl:108
 [25] include(mod::Module, _path::String)
    @ Base ./Base.jl:495
 [26] include(x::String)
    @ Plots ~/.julia/packages/Plots/ju9dp/src/Plots.jl:1
 [27] top-level scope
    @ ~/.julia/packages/Plots/ju9dp/src/Plots.jl:176
 [28] include
    @ ./Base.jl:495 [inlined]
 [29] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
    @ Base ./loading.jl:2222
 [30] top-level scope
    @ stdin:3
during initialization of module GRPreferences
in expression starting at /Users/chris/.julia/packages/Plots/ju9dp/src/init.jl:108
in expression starting at /Users/chris/.julia/packages/Plots/ju9dp/src/Plots.jl:1
in expression starting at stdin:
Stacktrace:
  [1] pkgerror(msg::String)
    @ Pkg.Types ~/.julia/juliaup/julia-1.10.2+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Pkg/src/Types.jl:70
  [2] precompile(ctx::Pkg.Types.Context, pkgs::Vector{…}; internal_call::Bool, strict::Bool, warn_loaded::Bool, already_instantiated::Bool, timing::Bool, _from_loading::Bool, kwargs::@Kwargs{…})
    @ Pkg.API ~/.julia/juliaup/julia-1.10.2+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Pkg/src/API.jl:1659
  [3] precompile(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::@Kwargs{_from_loading::Bool})
    @ Pkg.API ~/.julia/juliaup/julia-1.10.2+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Pkg/src/API.jl:159
  [4] precompile
    @ ~/.julia/juliaup/julia-1.10.2+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Pkg/src/API.jl:147 [inlined]
  [5] #precompile#114
    @ ~/.julia/juliaup/julia-1.10.2+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Pkg/src/API.jl:146 [inlined]
  [6] #invokelatest#2
    @ ./essentials.jl:894 [inlined]
  [7] invokelatest
    @ ./essentials.jl:889 [inlined]
  [8] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:1963
  [9] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1812
 [10] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
 [11] invoke_in_world
    @ ./essentials.jl:923 [inlined]
 [12] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1803
 [13] macro expansion
    @ ./loading.jl:1790 [inlined]
 [14] macro expansion
    @ ./lock.jl:267 [inlined]
 [15] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1753
 [16] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
 [17] invoke_in_world
    @ ./essentials.jl:923 [inlined]
 [18] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1746
 [19] eval
    @ ./boot.jl:385 [inlined]
 [20] eval
    @ ./Base.jl:88 [inlined]
 [21] repleval(m::Module, code::Expr, ::String)
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.76.2/scripts/packages/VSCodeServer/src/repl.jl:229
 [22] (::VSCodeServer.var"#112#114"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.76.2/scripts/packages/VSCodeServer/src/repl.jl:192
 [23] with_logstate(f::Function, logstate::Any)
    @ Base.CoreLogging ./logging.jl:515
 [24] with_logger
    @ ./logging.jl:627 [inlined]
 [25] (::VSCodeServer.var"#111#113"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.76.2/scripts/packages/VSCodeServer/src/repl.jl:193
 [26] #invokelatest#2
    @ ./essentials.jl:892 [inlined]
 [27] invokelatest(::Any)
    @ Base ./essentials.jl:889
 [28] (::VSCodeServer.var"#64#65")()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.76.2/scripts/packages/VSCodeServer/src/eval.jl:34
Some type information was truncated. Use `show(err)` to see complete types.

```

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [May 2, 2024, 2:26pm UTC](https://discourse.julialang.org/t/using-plots-errors-error-loaderror-initerror-undefvarerror-gr-jll-not-defined/113742/2 "2024-05-02T14:26:15Z")

</div>

Did you try these specific instructions that I posted yesterday?

> [@GR\_jll not compiling in Julia 1.10.3](https://discourse.julialang.org/t/gr-jll-not-compiling-in-julia-1-10-3/113693/13):
>
> Here’s workaround until the registry changes propagate. This includes force precompilation of GR. using Pkg # skip activation of a temp environment if you are trying to fix your environment Pkg.activate(; temp=true) # Add LERC\_jll version 3 Pkg.add([PackageSpec(name="GR"), PackageSpec(name="LERC\_jll", version="3")]) # Force GR to precompile Base.compilecache(Base.PkgId(Base.UUID("28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71"), "GR"))

```julia
using Pkg
# skip activation of a temp environment if you are trying to fix your environment
Pkg.activate(; temp=true)
# Add LERC_jll version 3
Pkg.add([
    PackageSpec(name="GR"),
    PackageSpec(name="LERC_jll", version="3")
])
# Force GR to precompile
Base.compilecache(Base.PkgId(Base.UUID("28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71"), "GR"))

```

There was package, `LERC_jll` which contained a binary neeed by libtiff which is need by GR which is needed by plots. A few days ago that library was updated to version 4 form version 3. It turns out libtiff is not compatible with version 4 which started the failure cascade.

I should also mention that perhaps Plots.jl should not be the first plotting package you reach for, although I understand why that might seem like the most obvious choice. As you can see above it has a a lot of external dependencies.

I generally reach for Makie.jl first, specifically the GLMakie.jl backend.

---

<div class="post-metadata">

**Author:** ![Torkel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/torkel/32/5030_2.png) [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Post date:** [May 2, 2024, 2:28pm UTC](https://discourse.julialang.org/t/using-plots-errors-error-loaderror-initerror-undefvarerror-gr-jll-not-defined/113742/3 "2024-05-02T14:28:01Z")

</div>

I did not try the `PackageSpec(name="LERC_jll", version="3")`, yeah, that might work.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [May 2, 2024, 3:25pm UTC](https://discourse.julialang.org/t/using-plots-errors-error-loaderror-initerror-undefvarerror-gr-jll-not-defined/113742/4 "2024-05-02T15:25:07Z")

</div>

Here’s the timeline (time are EDT):

- April 29th 6:04 pm - [LERC: New version 4.0.0 by eschnett · Pull Request #8570 · JuliaPackaging/Yggdrasil · GitHub](https://github.com/JuliaPackaging/Yggdrasil/pull/8570) is submitted
- April 30th - There’s a blackout in London affecting Mose Giordano, taking out his boiler and other appliances.
- May 1st 4:48 am - [LERC: New version 4.0.0 by eschnett · Pull Request #8570 · JuliaPackaging/Yggdrasil · GitHub](https://github.com/JuliaPackaging/Yggdrasil/pull/8570) is merged and LERC\_jll v4 is released
- May 1st 7:04 am - Initial reports of problems with Plots.jl start rolling in:
  - [Errors with `GR_jll` loading `Libtiff_jll`: `tibtiff.so not found` · Issue #8580 · JuliaPackaging/Yggdrasil · GitHub](https://github.com/JuliaPackaging/Yggdrasil/issues/8580#issuecomment-2088401895)
  - [GR\_jll not compiling in Julia 1.10.3](https://discourse.julialang.org/t/gr-jll-not-compiling-in-julia-1-10-3/113693)
  - [https://julialang.slack.com/archives/C67TK21LJ/p1714568255178879](https://julialang.slack.com/archives/C67TK21LJ/p1714568255178879)

- May 1st 7:08 am - Mose Giordano identifies the root cause: [Errors with `GR_jll` loading `Libtiff_jll`: `tibtiff.so not found` · Issue #8580 · JuliaPackaging/Yggdrasil · GitHub](https://github.com/JuliaPackaging/Yggdrasil/issues/8580#issuecomment-2088298395)
- May 1st, 7:45 am - Adding LERC\_jll version 3 is confirmed to resolve initial reports of problems:  
[Errors with `GR_jll` loading `Libtiff_jll`: `tibtiff.so not found` · Issue #8580 · JuliaPackaging/Yggdrasil · GitHub](https://github.com/JuliaPackaging/Yggdrasil/issues/8580#issuecomment-2088330577)
- May 1st 9:16 am - Mose Giordano issues a fix from his phone despite having fried appliances - [[Libtiff\_jll] Fix compat bound with `LERC_jll` by giordano · Pull Request #105958 · JuliaRegistries/General · GitHub](https://github.com/JuliaRegistries/General/pull/105958)
- May 1st 9:22 am - Retroactive changes to the registry fixing package compatability are merged after CI is run

The issue was identified and a workaround became available in 2.5 hours. By my estimate there was a 4 - 5 hour window where this issue could have been encountered. It unfortunately corresponded with the 1.10.3 release when many people were also updating.

I think there might be some room for some CI improvements, and perhaps some extra special attention for Plots.jl. That said I’m overall impressed with the response.

Perhaps my only suggestion is to raise an issue earlier rather than later.

---

<div class="post-metadata">

**Author:** ![Torkel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/torkel/32/5030_2.png) [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Post date:** [May 2, 2024, 3:43pm UTC](https://discourse.julialang.org/t/using-plots-errors-error-loaderror-initerror-undefvarerror-gr-jll-not-defined/113742/5 "2024-05-02T15:43:16Z")

</div>

Sounds like we were unlucky, things happen.

I’ve had problems with `using Plots` crashing quite a few times before (I think `Pkg.build("Plots")` has been the usual solution, and thought that this might have been a related (but more sever case) of something that’s been around for a while. Seems it was unrelated though.
