Installation of Plots package fails on Ubuntu 18.04

Hello everyone. I met a problem when install Plots.jl package. The problem is I always failed to precompile a few things. I tried to look it up, but the solution of the past post is not clear enough for me, so I just start this new one. Anyways, here is the error:

(@v1.11) pkg> add Plots
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
  No Changes to `~/.julia/environments/v1.11/Project.toml`
  No Changes to `~/.julia/environments/v1.11/Manifest.toml`
Precompiling project...
  βœ— Cairo_jll
  βœ— Qt6Base_jll
  βœ— HarfBuzz_jll
  βœ— Qt6ShaderTools_jll
  βœ— libass_jll
  βœ— Pango_jll
  βœ— Qt6Declarative_jll
  βœ— libdecor_jll
  βœ— Qt6Wayland_jll
  βœ— FFMPEG_jll
  βœ— GLFW_jll
  βœ— FFMPEG
  βœ— GR_jll
  βœ— GR
  βœ— Plots
  βœ— Plots β†’ UnitfulExt
  0 dependencies successfully precompiled in 78 seconds. 171 already precompiled.
  16 dependencies errored.
  For a report of the errors see `julia> err`. To retry use `pkg> precompile`

Based on the replies in other posts, I also check the status of my package and versioninfo() :

status --outdated -m
Status `~/.julia/environments/v1.11/Manifest.toml`
βŒ… [b22a6f82] FFMPEG_jll v4.4.4+1 (<v7.1.0+0): FFMPEG
βŒ… [e9f186c6] Libffi_jll v3.2.2+2 (<v3.4.6+4): Glib_jll, HarfBuzz_jll, Wayland_jll
βŒ… [30392449] Pixman_jll v0.43.4+0 (<v0.44.2+0): Cairo_jll
βŒ… [c0090381] Qt6Base_jll v6.7.1+1 (<v6.8.2+1): GR_jll, Qt6Declarative_jll, Qt6ShaderTools_jll, Qt6Wayland_jll
βŒ… [629bc702] Qt6Declarative_jll v6.7.1+2 (<v6.8.2+1): Qt6Wayland_jll
βŒ… [ce943373] Qt6ShaderTools_jll v6.7.1+1 (<v6.8.2+1): Qt6Declarative_jll
βŒƒ [e99dba38] Qt6Wayland_jll v6.7.1+1 (<v6.8.2+0)
βŒ… [1270edf5] x264_jll v2021.5.5+0 (<v10164.0.1+0): FFMPEG_jll
βŒ… [dfaa095f] x265_jll v3.5.0+0 (<v4.1.0+0): FFMPEG_jll 
Julia Version 1.11.3
Commit d63adeda50d (2025-01-21 19:42 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 12 Γ— Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, haswell)

I do notice there are some overlaps between the failed compilation and outdated packages, but I don’t know if the issue is this one.

And what’s the error?

But yeah I’d say first fix those old versions. From your pkg prompt I guess you are dumping all your packages into the default environment, leading to version conflicts. Don’t do that, work in project specific environments instead.

For a quick check on whether that’s the issue do ] activate --temp and add Plots there

The error is like this:


Plots 

Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to "/home/zhiyufan/.julia/compiled/v1.11/Plots/jl_2JtyZT".
ERROR: LoadError: InitError: could not load library "/home/zhiyufan/.julia/artifacts/6d8a1f48d4b47dc03fa048d88680be84ae15e5fc/lib/libgobject-2.0.so"
/home/zhiyufan/.julia/artifacts/6d8a1f48d4b47dc03fa048d88680be84ae15e5fc/lib/libgobject-2.0.so: undefined symbol: g_dir_unref
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl ./libdl.jl:120
  [2] dlopen(s::String, flags::UInt32)
    @ Base.Libc.Libdl ./libdl.jl:119
  [3] macro expansion
    @ ~/.julia/packages/JLLWrappers/GfYNv/src/products/library_generators.jl:63 [inlined]
  [4] __init__()
    @ Glib_jll ~/.julia/packages/Glib_jll/hPWTx/src/wrappers/x86_64-linux-gnu.jl:43
  [5] run_module_init(mod::Module, i::Int64)
    @ Base ./loading.jl:1378
  [6] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1366
  [7] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any}, ignore_native::Nothing; register::Bool)
    @ Base ./loading.jl:1254
  [8] _include_from_serialized (repeats 2 times)
    @ ./loading.jl:1210 [inlined]
  [9] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128, stalecheck::Bool; reasons::Dict{String, Int64}, DEPOT_PATH::Vector{String})
    @ Base ./loading.jl:2057
 [10] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:2527
 [11] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:2388
 [12] #invoke_in_world#3
    @ ./essentials.jl:1089 [inlined]
 [13] invoke_in_world
    @ ./essentials.jl:1086 [inlined]
 [14] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:2375
 [15] macro expansion
    @ ./loading.jl:2314 [inlined]
 [16] macro expansion
    @ ./lock.jl:273 [inlined]
 [17] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:2271
 [18] #invoke_in_world#3
    @ ./essentials.jl:1089 [inlined]
 [19] invoke_in_world
    @ ./essentials.jl:1086 [inlined]
 [20] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:2260
 [21] include(mod::Module, _path::String)
    @ Base ./Base.jl:557
 [22] top-level scope
    @ ~/.julia/packages/JLLWrappers/GfYNv/src/toplevel_generators.jl:199
 [23] include
    @ ./Base.jl:557 [inlined]
 [24] 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::String)
    @ Base ./loading.jl:2881
 [25] top-level scope
    @ stdin:6
during initialization of module Glib_jll
in expression starting at /home/zhiyufan/.julia/packages/Cairo_jll/UW7QZ/src/wrappers/x86_64-linux-gnu.jl:4
in expression starting at /home/zhiyufan/.julia/packages/Cairo_jll/UW7QZ/src/Cairo_jll.jl:2
in expression starting at stdin:6

I tried this ] activate --temp, but error remains.
Also I don’t update those packages, because I see this:

Info Packages marked with βŒƒ and βŒ… have new versions available. Those with βŒƒ may be upgradable, but those with βŒ… are restricted by compatibility constraints from upgrading.

But I assume the packages are up to date in your temp environment?

When I try to update, I got the same message

(jl_lUbmg5) pkg> update
    Updating registry at `~/.julia/registries/General.toml`
  No Changes to `/tmp/jl_lUbmg5/Project.toml`
  No Changes to `/tmp/jl_lUbmg5/Manifest.toml`
Precompiling project...
  βœ— Cairo_jll
  βœ— Qt6Base_jll
  βœ— HarfBuzz_jll
  βœ— Qt6ShaderTools_jll
  βœ— libass_jll
  βœ— Pango_jll
  βœ— Qt6Declarative_jll
  βœ— libdecor_jll
  βœ— Qt6Wayland_jll
  βœ— FFMPEG_jll
  βœ— GLFW_jll
  βœ— FFMPEG
  βœ— GR_jll
  βœ— GR
  βœ— Plots
  βœ— Plots β†’ UnitfulExt
  0 dependencies successfully precompiled in 73 seconds. 171 already precompiled.
  16 dependencies errored.
  For a report of the errors see `julia> err`. To retry use `pkg> precompile`

As a first step, make a backup of your global Project.toml and Manifest.toml file, which can be found here:

ls ~/.julia/environments/v1.11
Manifest.toml  Project.toml

Then delete them.

Then install Plots.jl in a new, empty environment:

mkdir myproject
cd myproject
julia --startup-file=no --project=.

and then in Julia:

using Pkg
pkg"add Plots"

Does that work?

If that should work, you could then add - one by one - the other packages you need for your project.

No it doesn’t work. Same thing

How did you install Julia?

Using juliaup. I even install a new version, which is older v1.10.8, just in case if the constrain can be removed, but no luck

Worst case just rename the .julia folder and try again.

mv .julia .julia_bak

If that does not help, perhaps you have a very unusual Linux distribution or CPU?

The same. Probably a really older version of the Linux.

NAME="Ubuntu"
VERSION="18.04.5 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.5 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

Well, an LTS version is usually supported for 5 years… I have still Julia code running on Ubuntu 18.04. I use ControlPlots.jl, though.

1 Like

Thanks, I just tried that. But seems both need those packages, so I don’t know what is going on.

I just tried ControlPlots.jl on Ubuntu 18.04 using Julia 1.10.7, and it works fine.
Worth to mention: Install matplotlib first, using the command:

sudo apt install python3-matplotlib

I also tried to use Plots.jl on Ubuntu 18.04. The installation works, but the command using Plots fails.

Whatever you do, do it in a clean environment:

mkdir test
cd test
julia --project=.

and then in Julia:

using Pkg
pkg"add ControlPlots"

So if you need a working Plots.jl package you need to upgrade Ubuntu, which is usually easy.

This shows that the chain of dynamic libraries is broken on your system. (g_dir_unref should be resolved by another library in the same artifact directory, but some older version of the library has presumably been loaded instead.)
Do you have LD_LIBRARY_PATH or something similar in your environment variables?

The output is this, and I don’t find anything like that.

(base) zhiyufan@athena:~$ echo $LD_LIBRARY_PATH
/home/zhiyufan/miniconda3/lib:/home/zhiyufan/miniconda3/lib:/public/software/mpi/openmpi/2.0.2/intel/lib:/opt/app/intel/2020/compilers_and_libraries_2020.4.304/linux/daal/…/tbb/lib/intel64_lin/gcc4.8:/opt/app/intel/2020/compilers_and_libraries_2020.4.304/linux/daal/…/tbb/lib/intel64_lin/gcc4.4:/opt/app/intel/2020/compilers_and_libraries_2020.4.304/linux/daal/lib/intel64_lin:/opt/app/intel/2020/debugger_2020/python/intel64/lib:/opt/app/intel/2020/debugger_2020/libipt/intel64/lib:/opt/app/intel/2020/compilers_and_libraries_2020.4.304/linux/tbb/lib/intel64/gcc4.8:/opt/app/intel/2020/compilers_and_libraries_2020.4.304/linux/mkl/lib/intel64_lin:/opt/app/intel/2020/compilers_and_libraries_2020.4.304/linux/ipp/lib/intel64:/opt/app/intel/2020/compilers_and_libraries_2020.4.304/linux/compiler/lib/intel64_lin:/public/software/mathlib/blitz/lib:/public/software/mathlib/fftw/fftw-3.3.9/lib:/public/software/mpi/oompi/lib:/public/software/mathlib/blitz/lib:/public/software/mathlib/fftw/fftw-3.3.9/lib:/public/software/mpi/oompi/lib:/public/software/mathlib/blitz/lib:/public/software/mathlib/fftw/fftw-3.3.9/lib:/public/software/mpi/oompi/lib

I checked and found out that it was already installed.