Using Plots fails (partially solved but mysterious)

With Julia 1.7 on ubuntu, and with the latest Plots release, running using Plots
yields the error:

ERROR: InitError: could not load library "/home/users/tarnon/.julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so"
/home/users/tarnon/.julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so: undefined symbol: g_uri_ref
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:117
  [3] macro expansion
    @ ~/.julia/packages/JLLWrappers/QpMQW/src/products/library_generators.jl:54 [inlined]
  [4] __init__()
    @ Glib_jll ~/.julia/packages/Glib_jll/2OVnY/src/wrappers/x86_64-linux-gnu.jl:36
  [5] _include_from_serialized(path::String, depmods::Vector{Any})
    @ Base ./loading.jl:768
  [6] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base ./loading.jl:854
  [7] _tryrequire_from_serialized(modkey::Base.PkgId, build_id::UInt64, modpath::String)
    @ Base ./loading.jl:783
  [8] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base ./loading.jl:843
  [9] _tryrequire_from_serialized(modkey::Base.PkgId, build_id::UInt64, modpath::String)
    @ Base ./loading.jl:783
 [10] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base ./loading.jl:843
 [11] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1097
 [12] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1013
 [13] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:997
during initialization of module Glib_jll

Following the tips from this other issue, I tried messing with the ENV variables discussed there.

I found that I could get Plots to work by starting julia with LD_LIBRARY_PATH="" julia, but notably, it would NOT work if I set ENV["LD_LIBRARY_PATH"] = "" AFTER starting julia (likewise if I tried to set it in startup.jl).

Furthermore, if I check dllist() as suggested in the case where it works vs. when it doesn’t, I see a difference in the libraries loaded:

when it doesn’t work:

~$ julia -q
julia> using Plots
ERROR: InitError: could not load library "/home/users/tarnon/.julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so"
/home/users/tarnon/.julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so: undefined symbol: g_uri_ref
Stacktrace:
...
during initialization of module Glib_jll

julia> using Libdl

julia> filter!(lib -> occursin("glib", lib), dllist())
2-element Vector{String}:
 "/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0"
 "/home/users/tarnon/.julia/artif" â‹Ż 33 bytes â‹Ż "28e535fab269/lib/libglib-2.0.so"

When it works:

~$ LD_LIBRARY_PATH="" julia -q
julia> using Plots

julia> using Libdl

julia> filter!(lib -> occursin("glib", lib), dllist())
1-element Vector{String}:
 "/home/users/tarnon/.julia/artif" â‹Ż 35 bytes â‹Ż "e535fab269/lib/libglib-2.0.so.0"

When julia is started with LD_LIBRARY_PATH = "", only one glib-referencing library is found, and the second one, which seems in common between the two cases, actually isn’t the same library. Notice the .so.0 at the end, instead of just .so.


I didn’t think to try this before, but now that I check, just running using Plots over and over eventually gets it to work (regardless of whether I set LD_LIBRARY_PATH).

julia> using Plots
ERROR: InitError: could not load library "/home/users/tarnon/.julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so"
/home/users/tarnon/.julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so: undefined symbol: g_uri_ref
Stacktrace:
 ...
during initialization of module Glib_jll

julia> using Plots
ERROR: InitError: could not load library "/home/users/tarnon/.julia/artifacts/f3ec73d7bf2f4419ba0943e94f7738cf56050797/lib/libexslt.so"
/usr/lib/x86_64-linux-gnu/libxslt.so.1: version `LIBXML2_1.1.30` not found (required by /home/users/tarnon/.julia/artifacts/f3ec73d7bf2f4419ba0943e94f7738cf56050797/lib/libexslt.so)
Stacktrace:
  ...
during initialization of module XSLT_jll

julia> using Plots # works this time...

The fact that eventually it works is nice, but I’d like to figure out how to get things streamlined again.

2 Likes

Hello I have the same error did you figured it out how to resolve the issue - how to add LD_LIBRARY_PATH=“” julia -q to be always used?

Help!!! I have a class of 200 incoming students and have told them to download/install Julia1.8 but (after working initially) Plots is broken on my Mac in the way described above!! I can’t have students using a broken package!! [Do I need to make a last-minute change to Python?]
Thanks for any help.

2 Likes