Can't install Plots on julia-1.6.0

I can’t install the Plots package on julia-1.6.0. I’ve moved my ~/.julia directory and re-added the package but it fails the same way, as follows

gibson@sophist$ mv ~/.julia ~/.julia-2021-04-15
gibson@sophist$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.6.0 (2021-03-24)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using Pkg

julia> Pkg.add("Plots")
  Installing known registries into `~/.julia`
       Added registry `General` to `~/.julia/registries/General`
   Resolving package versions...
   Installed LaTeXStrings ───────────────── v1.2.1
   Installed Xorg_libXdmcp_jll ──────────── v1.1.3+4
   ...omit many lines here...
[3f19e933] + p7zip_jll
    Building GR → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/82a03d9c331d181bf33c99c9af04202cc4533d48/build.log`
Precompiling project...
  Progress [========================================>]  113/113
  ✗ GR_jll
  ✗ Plots
111 dependencies successfully precompiled in 46 seconds
2 dependencies errored

julia> Pkg.build("Plots")
    Building GR → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/82a03d9c331d181bf33c99c9af04202cc4533d48/build.log`
Precompiling project...
  Progress [========================================>]  3/3
  ✗ Plots
1 dependency successfully precompiled in 12 seconds (110 already precompiled, 1 skipped during auto due to previous errors)
1 dependency errored

shell> cat ~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/82a03d9c331d181bf33c99c9af04202cc4533d48/build.log
┌ Info: Creating depsfile. GR provider is BinaryBuilder
│   provider = "BinaryBuilder"
└   depsfile = "/home/gibson/.julia/packages/GR/qSS8e/deps/deps.jl"

julia> versioninfo()
Julia Version 1.6.0
Commit f9720dc2eb (2021-03-24 12:55 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-3960X CPU @ 3.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, sandybridge)

This is on openSUSE-15.2, x86-64. Any ideas?

What happens when you just try to use Plots? Do you still get an error?

I think we just need Plots to try to precompile itself again.

I didn’t think to try it! It doesn’t work, however. When trying to build GR it reports an error in the GR depsfile and gives this error message

ERROR: LoadError: LoadError: InitError: Evaluation into the closed module GR breaks incremental compilation because the side effects will not be permanent. This is likely due to some other module mutating GR with eval during precompilation - don’t do this.

julia> using Plots
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
Your GR installation is incomplete. Rerunning build step for GR package.
┌ Info: Switching provider to GR due to error in depsfile
└   depsfile = "/home/gibson/.julia/packages/GR/qSS8e/deps/deps.jl"
ERROR: LoadError: LoadError: InitError: Evaluation into the closed module `GR` breaks incremental compilation because the side effects will not be permanent. This is likely due to some other module mutating `GR` with `eval` during precompilation - don't do this.
Stacktrace:
  [1] eval
    @ ./boot.jl:360 [inlined]
  [2] __init__()
    @ GR ~/.julia/packages/GR/qSS8e/src/GR.jl:311
  [3] _include_from_serialized(path::String, depmods::Vector{Any})
    @ Base ./loading.jl:674
  [4] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base ./loading.jl:760
  [5] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:998
  [6] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:914
  [7] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:901
  [8] include(mod::Module, _path::String)
    @ Base ./Base.jl:386
  [9] include(x::String)
    @ Plots ~/.julia/packages/Plots/SVksJ/src/Plots.jl:1
 [10] top-level scope
    @ ~/.julia/packages/Plots/SVksJ/src/Plots.jl:218
 [11] include
    @ ./Base.jl:386 [inlined]
 [12] 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:1213
 [13] top-level scope
    @ none:1
 [14] eval
    @ ./boot.jl:360 [inlined]
 [15] eval(x::Expr)
    @ Base.MainInclude ./client.jl:446
 [16] top-level scope
    @ none:1
during initialization of module GR
in expression starting at /home/gibson/.julia/packages/Plots/SVksJ/src/backends/gr.jl:6
in expression starting at /home/gibson/.julia/packages/Plots/SVksJ/src/Plots.jl:1
ERROR: Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to /home/gibson/.julia/compiled/v1.6/Plots/jl_t5Y9EB.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::Base.TTY, internal_stdout::Base.TTY)
   @ Base ./loading.jl:1360
 [3] compilecache(pkg::Base.PkgId, path::String)
   @ Base ./loading.jl:1306
 [4] _require(pkg::Base.PkgId)
   @ Base ./loading.jl:1021
 [5] require(uuidkey::Base.PkgId)
   @ Base ./loading.jl:914
 [6] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:901

shell> cat /home/gibson/.julia/packages/GR/qSS8e/deps/deps.jl
    import GR_jll

julia> 

Well that just changed something, it switched the binary provider over to GR from BinaryBuilder. What happens if you try to use Plots one more time?

What happens if you just try using GR? How about import GR_jll ?

We can gain more insight into what is happening by enabling debugging.

julia> ENV["JULIA_DEBUG"] = "GR"
"GR"

This will try to reset you back to BinaryBuilder:

julia> ENV["GRDIR"] = ""
""

julia> ENV["JULIA_GR_PROVIDER"] = "BinaryBuilder"
"BinaryBuilder"

(@v1.6) pkg> build GR 

If that doesn’t work, try

julia> ENV["GRDIR"] = ""
""

julia> ENV["JULIA_GR_PROVIDER"] = "GR"
"GR"

(@v1.6) pkg> build GR

using GR revealed that GR was not installed. So I did

julia> Pkg.add("GR")
    Updating registry at `~/.julia/registries/General`
   Resolving package versions...
    Updating `~/.julia/environments/v1.6/Project.toml`
  [28b8d3ca] + GR v0.57.3
  No Changes to `~/.julia/environments/v1.6/Manifest.toml`

julia> using Plots
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
Your GR installation is incomplete. Rerunning build step for GR package.
┌ Info: Switching provider to GR due to error in depsfile
└   depsfile = "/home/gibson/.julia/packages/GR/qSS8e/deps/deps.jl"
ERROR: LoadError: LoadError: InitError: Evaluation into the closed module `GR` breaks incremental compilation because the side effects will not be permanent. This is likely due to some other module mutating `GR` with `eval` during precompilation - don't do this.

Success! I followed your first suggestion to switch back to BinaryBuilder. In the course of building GR, the build system once again changed the GR provider, but this time compilation eventually succeeded.

julia> ENV["GRDIR"] = ""
""

julia> ENV["JULIA_GR_PROVIDER"] = "BinaryBuilder"
"BinaryBuilder"
(@v1.6) pkg> build GR
    Building GR → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/82a03d9c331d181bf33c99c9af04202cc4533d48/build.log`
Precompiling project...
  Progress [========================================>]  3/3
  ✗ Plots
1 dependency successfully precompiled in 12 seconds (110 already precompiled, 1 skipped during auto due to previous errors)
1 dependency errored

julia> using GR
Your GR installation is incomplete. Rerunning build step for GR package.
┌ Info: Switching provider to GR due to error in depsfile
└   depsfile = "/home/gibson/.julia/packages/GR/qSS8e/deps/deps.jl"
    Building GR → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/82a03d9c331d181bf33c99c9af04202cc4533d48/build.log`
Precompiling project...
  Progress [========================================>]  3/3
  ? Plots
1 dependency successfully precompiled in 9 seconds (110 already precompiled, 1 skipped during auto due to previous errors)
1 dependency failed but may be precompilable after restarting julia
[ Info: GR was successfully rebuilt

After restarting

julia> using GR

julia> using Plots
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]

and Plots works. Thank you!

2 Likes

Great.

I would be interested in figuring out what the output of the following commands looks like on your machine.

julia> import Pkg; Pkg.add("GR_jll"); import GR_jll
   Resolving package versions...
  No Changes to `C:\Users\kittisopikulm\.julia\environments\v1.6\Project.toml`
  No Changes to `C:\Users\kittisopikulm\.julia\environments\v1.6\Manifest.toml`

It looks like the GR_jll.jl provided binaries are not working whereas the GR provided tarball is working.

Hmmm. Maybe it is that my OS Qt5 version is 5.12 rather than 5.15?

julia> import Pkg; Pkg.add("GR_jll"); import GR_jll
    Updating registry at `~/.julia/registries/General`
   Resolving package versions...
    Updating `~/.julia/environments/v1.6/Project.toml`
  [d2c73de3] + GR_jll v0.57.2+0
  No Changes to `~/.julia/environments/v1.6/Manifest.toml`
[ Info: Precompiling GR_jll [d2c73de3-f751-5644-a686-071e5b155ba9]
ERROR: LoadError: LoadError: InitError: could not load library "/home/gibson/.julia/artifacts/7835210e9722f2d04d4e74972925b5c43d9cfcaa/lib/libQt5Concurrent.so"
/usr/lib64/libQt5Core.so.5: version `Qt_5.15' not found (required by /home/gibson/.julia/artifacts/7835210e9722f2d04d4e74972925b5c43d9cfcaa/lib/libQt5Concurrent.so)
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl ./libdl.jl:114
  [2] dlopen(s::String, flags::UInt32)
    @ Base.Libc.Libdl ./libdl.jl:114
  [3] macro expansion
    @ ~/.julia/packages/JLLWrappers/WnWcZ/src/products/library_generators.jl:63 [inlined]
  [4] __init__()
    @ Qt5Base_jll ~/.julia/packages/Qt5Base_jll/Ks8eF/src/wrappers/x86_64-linux-gnu-cxx11.jl:31
  [5] _include_from_serialized(path::String, depmods::Vector{Any})
    @ Base ./loading.jl:674
  [6] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base ./loading.jl:760
  [7] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:998
  [8] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:914
  [9] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:901
 [10] include(mod::Module, _path::String)
    @ Base ./Base.jl:386
 [11] top-level scope
    @ ~/.julia/packages/JLLWrappers/WnWcZ/src/toplevel_generators.jl:170
 [12] include
    @ ./Base.jl:386 [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:1213
 [14] top-level scope
    @ none:1
 [15] eval
    @ ./boot.jl:360 [inlined]
 [16] eval(x::Expr)
    @ Base.MainInclude ./client.jl:446
 [17] top-level scope
    @ none:1
during initialization of module Qt5Base_jll
in expression starting at /home/gibson/.julia/packages/GR_jll/lXOy4/src/wrappers/x86_64-linux-gnu-cxx11.jl:13
in expression starting at /home/gibson/.julia/packages/GR_jll/lXOy4/src/GR_jll.jl:2
ERROR: Failed to precompile GR_jll [d2c73de3-f751-5644-a686-071e5b155ba9] to /home/gibson/.julia/compiled/v1.6/GR_jll/jl_JK86kc.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::Base.TTY, internal_stdout::Base.TTY)
   @ Base ./loading.jl:1360
 [3] compilecache(pkg::Base.PkgId, path::String)
   @ Base ./loading.jl:1306
 [4] _require(pkg::Base.PkgId)
   @ Base ./loading.jl:1021
 [5] require(uuidkey::Base.PkgId)
   @ Base ./loading.jl:914
 [6] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:901
gibson@sophist$ rpm -qif /usr/lib64/libQt5Core.so.5
Name        : libQt5Core5
Version     : 5.12.7
Release     : lp152.3.16.1
Architecture: x86_64
Install Date: Mon 21 Dec 2020 12:05:46 PM EST
Group       : Development/Libraries/X11
Size        : 5937956
License     : LGPL-2.1-with-Qt-Company-Qt-exception-1.1 or LGPL-3.0-only
Signature   : RSA/SHA256, Thu 17 Dec 2020 06:04:14 PM EST, Key ID b88b2fd43dbdc284
Source RPM  : libqt5-qtbase-5.12.7-lp152.3.16.1.src.rpm
Build Date  : Thu 17 Dec 2020 05:55:01 PM EST
Build Host  : goat05
Relocations : (not relocatable)
Packager    : http://bugs.opensuse.org
Vendor      : openSUSE
URL         : https://www.qt.io
Summary     : Qt 5 Core Library
Distribution: openSUSE Leap 15.2

Yea that does not look good. It should not be using your system Qt at all actually. It should be using the one from GitHub - JuliaBinaryWrappers/Qt5Base_jll.jl , so you might want to file an issue there.

Pinging @barche and @giordano .

@John_Gibson any chance you are on Mac OS? I reported this bug some days ago because GitHub Actions is consistently failing on Mac OS with a similar error message: [BUG] Precompilation failing on GitHub Actions (MacOS) · Issue #3431 · JuliaPlots/Plots.jl · GitHub

Does the error happen if you try to install Plots in a clean julia session? What’s the value of the LD_LIBRARY_PATH environment variable inside julia?

He’s on openSUSE-15.2 running on Intel.

Check this Slack thread.

Also see LoadError: InitError: Evaluation into the closed module `GR` breaks incremental compilation · Issue #390 · jheinen/GR.jl · GitHub

Yes, I’m running openSUE-15.2 Linux on x86-64. The error happened first on my working julia-1.6.0 and then just the same way when I removed ~/.julia and did Pkg.add(“Plots”) as the first statement after starting Julia.

LD_LIBRARY_PATH in Julia ENV is /usr/lib64:/usr/lib64/mpi/gcc/openmpi/lib64:/home/gibson/channelflow-master/lib:/home/gibson/lib

That’s the issue. Empty the variable when running julia, for example with

LD_LIBRARY_PATH="" julia
1 Like

GR_jll successfully loads and compiles after emptying LD_LIBRARY_PATH as you suggested. Should julia always be run with empty LD_LIBRARY_PATH? Should I have known this?

Starting with LD_LIBRARY_PATH="" julia at bash prompt

julia> ENV["LD_LIBRARY_PATH"]
""
julia> import Pkg; Pkg.add("GR_jll"); import GR_jll
    Updating registry at `~/.julia/registries/General`
   Resolving package versions...
  No Changes to `~/.julia/environments/v1.6/Project.toml`
  No Changes to `~/.julia/environments/v1.6/Manifest.toml`
[ Info: Precompiling GR_jll [d2c73de3-f751-5644-a686-071e5b155ba9]

The official Julia binaries and all the packages ending with _jll vendor the binary libraries, so that users don’t need to figure out how to install them. LD_LIBRARY_PATH overrides that mechanism. So in general I’d recommend to never set LD_LIBRARY_PATH when running julia, unless you perfectly know what you’re doing.

2 Likes

Seems the main issue was solved by @giordano, but just a tip to avoid removing your .julia for this kind of debugging: you can use JULIA_DEPOT_PATH to use a temporary directory, and it will be as if you run a clean julia installation, e.g:

JULIA_DEPOT_PATH=/home/user/tmp/depot_grtest julia
4 Likes

Thanks. I actually just renamed ~/.julia to something and so accomplished the same, but the JULIA_DEPOT_PATH approach is cleaner.

I’ve long used LD_LIBRARY_PATH to help applications find shared libraries, particularly software that I build myself. I will revisit whether this is really necessary.

Thanks everyone for your help!