# Using Plots fails (partially solved but mysterious)

**URL:** <https://discourse.julialang.org/t/using-plots-fails-partially-solved-but-mysterious/76120>\
**Category:** General Usage\
**Tags:** question, artifacts, glib\_jll, xslt\_jll\
**Created:** [February 9, 2022, 9:02pm UTC](https://discourse.julialang.org/t/using-plots-fails-partially-solved-but-mysterious/76120 "2022-02-09T21:02:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomerarnon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomerarnon/32/3170_2.png) [@tomerarnon](https://discourse.julialang.org/u/tomerarnon)\
**Post date:** [February 9, 2022, 9:02pm UTC](https://discourse.julialang.org/t/using-plots-fails-partially-solved-but-mysterious/76120/1 "2022-02-09T21:02:17Z")

</div>

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

```julia
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](https://discourse.julialang.org/t/juliacall-cant-use-a-package-that-builds-fine-outside-juliacall-random-file-path-ending-in-artifacts-libgobject-2-0-so-undefined-symbol-g-uri-ref/68289/2), 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
~$ 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:

```julia
~$ 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
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.

---

<div class="post-metadata">

**Author:** ![Jakub\_Mitura](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jakub_mitura/32/19496_2.png) [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Post date:** [September 6, 2022, 6:39pm UTC](https://discourse.julialang.org/t/using-plots-fails-partially-solved-but-mysterious/76120/2 "2022-09-06T18:39:45Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![compleat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/compleat/32/8958_2.png) [@compleat](https://discourse.julialang.org/u/compleat)\
**Post date:** [October 12, 2022, 1:07pm UTC](https://discourse.julialang.org/t/using-plots-fails-partially-solved-but-mysterious/76120/3 "2022-10-12T13:07:45Z")

</div>

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.
