Cannot Precompile Plots.jl due to GR

Hi there,

I recently upgraded to 1.8.0. At some point I lost the ability to precompile plots due to a GR_jll error. I see other people have had similar issues and have tried the following with no luck:

  • Removing .julia
  • Building GR again
  • Setting ENV[“GRDIR”] = “”

The only solution I have found to work is downgrading the GR.jl package. Otherwise I get the following error:
ERROR: LoadError: InitError: UndefVarError: GR_jll not defined

Can anyone explain why this is the case? I’d rather not have to downgrade any of my packages.

FYI I’m on a linux machine.

1 Like

what versions of packages do you have?

(@v1.8) pkg> status
Status ~/.julia/environments/v1.8/Project.toml
[336ed68f] CSV v0.10.4
[82f2e89e] ClickHouse v0.2.2
[1313f7d8] DataFramesMeta v0.12.0
[28b8d3ca] GR v0.69.3
[91a5bcdd] Plots v1.35.2

1 Like

Can you output the whole stacktrace ? We’ve had some issues with window or macOS recently, but none on linux.

Is your julia an official release (Download Julia) of a build of your distro ?

ERROR: LoadError: InitError: UndefVarError: GR_jll not defined
Stacktrace:
[1] init()
@ GR.GRPreferences ~/.julia/packages/GR/Wz6ek/src/preferences.jl:40
[2] _include_from_serialized(pkg::Base.PkgId, path::String, depmods::Vector{Any})
@ Base ./loading.jl:831
[3] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt64)
@ Base ./loading.jl:1039
[4] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1315
[5] _require_prelocked(uuidkey::Base.PkgId)
@ Base ./loading.jl:1200
[6] macro expansion
@ ./loading.jl:1180 [inlined]
[7] macro expansion
@ ./lock.jl:223 [inlined]
[8] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1144
[9] include(mod::Module, _path::String)
@ Base ./Base.jl:419
[10] include(x::String)
@ Plots ~/.julia/packages/Plots/CUQan/src/Plots.jl:1
[11] top-level scope
@ ~/.julia/packages/Plots/CUQan/src/Plots.jl:201
[12] include
@ ./Base.jl:419 [inlined]
[13] 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, UInt64}}, source::Nothing)
@ Base ./loading.jl:1554
[14] top-level scope
@ stdin:1
during initialization of module GRPreferences
in expression starting at /home/jcooper/.julia/packages/Plots/CUQan/src/backends/gr.jl:3
in expression starting at /home/jcooper/.julia/packages/Plots/CUQan/src/Plots.jl:1
in expression starting at stdin:1
ERROR: Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to /home/jcooper/.julia/compiled/v1.8/Plots/jl_hLRsn0.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
@ Base ./loading.jl:1705
[3] compilecache
@ ./loading.jl:1649 [inlined]
[4] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1337
[5] _require_prelocked(uuidkey::Base.PkgId)
@ Base ./loading.jl:1200
[6] macro expansion
@ ./loading.jl:1180 [inlined]
[7] macro expansion
@ ./lock.jl:223 [inlined]
[8] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1144

1 Like

Yes. It is a tar.gz download from official julia website.

1 Like

Thanks, now can set the environment variable JULIA_DEBUG to GR before starting julia ?

$ JULIA_DEBUG=GR julia
julia> using Plots
┌ Debug: import GR_jll failed
│   err = [...]
└ @ GR.GRPreferences [...]/GR.jl/src/preferences.jl:7

and post the output ?

Alternatively you can do this from within julia:

julia> ENV["JULIA_DEBUG"] = "GR";
julia> using Plots
[...]

It should trigger GR.jl/preferences.jl at ce153a2626413668d0387d6ff62008e2dc3fbf55 · jheinen/GR.jl · GitHub.

With the latest releases of Plots (1.35) and GR (0.69), you should not need to explicitly call out GR in the Project.toml. You should be able to ] rm GR, then ] up in Pkg mode without the need to build GR or anything like that. This is due to the transition to artifacts in GR to allow more extensive precompilation.

1 Like

With debug enabled:

julia>
(base) [jcooper@hkquant01 v1.8]$ JULIA_DEBUG=GR julia
_
_ _ ()_ | Documentation: https://docs.julialang.org
() | () () |
_ _ | | __ _ | Type “?” for help, “]?” for Pkg help.
| | | | | | |/ ` | |
| | |
| | | | (
| | | Version 1.8.0 (2022-08-17)
/ |_|||_’_| | Official https://julialang.org/ release
|__/ |

julia> using Plots
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
ERROR: LoadError: InitError: UndefVarError: GR_jll not defined
Stacktrace:
[1] init()
@ GR.GRPreferences ~/.julia/packages/GR/Wz6ek/src/preferences.jl:40
[2] _include_from_serialized(pkg::Base.PkgId, path::String, depmods::Vector{Any})
@ Base ./loading.jl:831
[3] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt64)
@ Base ./loading.jl:1039
[4] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1315
[5] _require_prelocked(uuidkey::Base.PkgId)
@ Base ./loading.jl:1200
[6] macro expansion
@ ./loading.jl:1180 [inlined]
[7] macro expansion
@ ./lock.jl:223 [inlined]
[8] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1144
[9] include(mod::Module, _path::String)
@ Base ./Base.jl:419
[10] include(x::String)
@ Plots ~/.julia/packages/Plots/CUQan/src/Plots.jl:1
[11] top-level scope
@ ~/.julia/packages/Plots/CUQan/src/Plots.jl:201
[12] include
@ ./Base.jl:419 [inlined]
[13] 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, UInt64}}, source::Nothing)
@ Base ./loading.jl:1554
[14] top-level scope
@ stdin:1
during initialization of module GRPreferences
in expression starting at /home/jcooper/.julia/packages/Plots/CUQan/src/backends/gr.jl:3
in expression starting at /home/jcooper/.julia/packages/Plots/CUQan/src/Plots.jl:1
in expression starting at stdin:1
ERROR: Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to /home/jcooper/.julia/compiled/v1.8/Plots/jl_1BdlLv.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
@ Base ./loading.jl:1705
[3] compilecache
@ ./loading.jl:1649 [inlined]
[4] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1337
[5] _require_prelocked(uuidkey::Base.PkgId)
@ Base ./loading.jl:1200
[6] macro expansion
@ ./loading.jl:1180 [inlined]
[7] macro expansion
@ ./lock.jl:223 [inlined]
[8] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1144

Not sure the debug has been triggered properly?

I get the same error regardless of whether I explicitly call GR or not. I just had it explicitly called because I was trying different versions.

I’ve also found I get a different error if I try to precompile GR_jll directly:

julia> using GR_jll
[ Info: Precompiling GR_jll [d2c73de3-f751-5644-a686-071e5b155ba9]
ERROR: LoadError: InitError: could not load library “/home/jcooper/.julia/artifacts/a84cc58d5161b950f268bb562e105bbbf4d6004a/lib/libEGL.so”
dlopen: cannot load any more object with static TLS
Stacktrace:
[1] dlopen(s::String, flags::UInt32; throw_error::Bool)
@ Base.Libc.Libdl ./libdl.jl:117
[2] dlopen(s::String, flags::UInt32)
@ Base.Libc.Libdl ./libdl.jl:116
[3] macro expansion
@ ~/.julia/packages/JLLWrappers/QpMQW/src/products/library_generators.jl:54 [inlined]
[4] init()
@ Libglvnd_jll ~/.julia/packages/Libglvnd_jll/pJrjy/src/wrappers/x86_64-linux-gnu.jl:16
[5] _include_from_serialized(pkg::Base.PkgId, path::String, depmods::Vector{Any})
@ Base ./loading.jl:831
[6] _tryrequire_from_serialized(modkey::Base.PkgId, path::String, sourcepath::String, depmods::Vector{Any})
@ Base ./loading.jl:938
[7] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt64)
@ Base ./loading.jl:1028
[8] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1315
[9] _require_prelocked(uuidkey::Base.PkgId)
@ Base ./loading.jl:1200
[10] macro expansion
@ ./loading.jl:1180 [inlined]
[11] macro expansion
@ ./lock.jl:223 [inlined]
[12] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1144
[13] include(mod::Module, _path::String)
@ Base ./Base.jl:419
[14] top-level scope
@ ~/.julia/packages/JLLWrappers/QpMQW/src/toplevel_generators.jl:188
[15] include
@ ./Base.jl:419 [inlined]
[16] 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, UInt64}}, source::Nothing)
@ Base ./loading.jl:1554
[17] top-level scope
@ stdin:1
during initialization of module Libglvnd_jll
in expression starting at /home/jcooper/.julia/packages/GR_jll/48Bah/src/wrappers/x86_64-linux-gnu-cxx11.jl:8
in expression starting at /home/jcooper/.julia/packages/GR_jll/48Bah/src/GR_jll.jl:2
in expression starting at stdin:1
ERROR: Failed to precompile GR_jll [d2c73de3-f751-5644-a686-071e5b155ba9] to /home/jcooper/.julia/compiled/v1.8/GR_jll/jl_DHHMuf.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
@ Base ./loading.jl:1705
[3] compilecache
@ ./loading.jl:1649 [inlined]
[4] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1337
[5] _require_prelocked(uuidkey::Base.PkgId)
@ Base ./loading.jl:1200
[6] macro expansion
@ ./loading.jl:1180 [inlined]
[7] macro expansion
@ ./lock.jl:223 [inlined]
[8] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1144

1 Like

I got this same error message and ]add GR fixed it for me.

1 Like

I’m getting the same issue, and adding/removing/building GR or GR_jll doesn’t work for me.

There have been multiple errors mentioned in this thread, what does “same” specifically refer to? In general, opening a new thread with detailed error message you get plus all relevant information about your system, including the output of versioninfo(), would be more useful.

Are you using a particularly old version of glibc by any chance? Your problem sounds like 17620 – DTV_SURPLUS limits loading of Static TLS-requiring modules in multi-threaded programs, which was fixed a few years ago. (Again, opening a different thread would have been more useful, there’s lots of noise in this thread now)

1 Like

Thanks for the response. Upgrading to Julia 1.8.4 resolved the issue for me (previously I was using 1.6.2 since that’s the default version on my cluster)

Below is my package versions on Julia 1.6.2

]st Plots GR GR_jll
      Status `/scratch/users/bbchu/.julia/environments/v1.6/Project.toml`
  [28b8d3ca] GR v0.71.8
  [91a5bcdd] Plots v1.38.8
  [d2c73de3] GR_jll v0.71.8+0
versioninfo()
Julia Version 1.6.2
Commit 1b93d53fc4 (2021-07-14 15:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: AMD EPYC 7742 64-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, znver2)
Environment:
  JULIA_DEPOT_PATH = /scratch/users/bbchu/.julia

This error may be resolved as described in this post:

In short, run the following and then restart Julia.

Base.compilecache(Base.identify_package("GR"))
1 Like