Julia fails to precompile plots

Can you delete ~/.julia/compiled and try again ?

Still not working…

Unfortunately, the error message above is not helpful.
Does using Pkg; Pkg.precompile() show the same error ?

yes it gives:

julia> using Pkg; Pkg.precompile()
Precompiling project...
  ✗ GR_jll
  ✗ Plots
  0 dependencies successfully precompiled in 12 seconds. 132 already precompiled.

ERROR: The following 1 direct dependency failed to precompile:

Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]

Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to /Users/matteomassaro/.julia/compiled/v1.8/Plots/jl_MeTmZV.
ERROR: LoadError: InitError: UndefVarError: GR_jll not defined
Stacktrace:
  [1] __init__()
    @ GR.GRPreferences ~/.julia/packages/GR/eEMaG/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 /Users/matteomassaro/.julia/packages/Plots/CUQan/src/backends/gr.jl:3
in expression starting at /Users/matteomassaro/.julia/packages/Plots/CUQan/src/Plots.jl:1
in expression starting at stdin:1
Stacktrace:
 [1] pkgerror(msg::String)
   @ Pkg.Types /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Types.jl:67
 [2] precompile(ctx::Pkg.Types.Context, pkgs::Vector{String}; internal_call::Bool, strict::Bool, warn_loaded::Bool, already_instantiated::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Pkg.API /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:1432
 [3] precompile
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:1063 [inlined]
 [4] #precompile#225
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:1062 [inlined]
 [5] precompile (repeats 2 times)
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:1062 [inlined]
 [6] top-level scope
   @ none:1

Can you restart julia, then type:

julia> ENV["JULIA_DEBUG"] = "GR";
julia> using Pkg; Pkg.precompile()

You should see the debug message as in Cannot Precompile Plots.jl due to GR - #7 by t-bltg.

How did you install Julia? One thing you could try is ignoring your old julia configuration and package files and trying again. You could do this by starting your Julia REPL like this

JULIA_DEPOT_PATH="$HOME/tmp/.julia" julia

(assuming that the $HOME/tmp/.julia directory is not currently used for anything else)

Then try a fresh install of Plots.

This :

gives me as output:


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

julia> using Pkg; Pkg.precompile()
Precompiling project...
  ✗ GR_jll
  ✓ Atom
  ✗ Plots
  17 dependencies successfully precompiled in 64 seconds. 150 already precompiled.
  1 dependency precompiled but a different version is currently loaded. Restart julia to access the new version

ERROR: The following 1 direct dependency failed to precompile:

Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]

Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to /Users/matteomassaro/.julia/compiled/v1.8/Plots/jl_vsOjN9.
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 /Users/matteomassaro/.julia/packages/Plots/CUQan/src/backends/gr.jl:3
in expression starting at /Users/matteomassaro/.julia/packages/Plots/CUQan/src/Plots.jl:1
in expression starting at stdin:1
Stacktrace:
 [1] pkgerror(msg::String)
   @ Pkg.Types /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Types.jl:67
 [2] precompile(ctx::Pkg.Types.Context, pkgs::Vector{String}; internal_call::Bool, strict::Bool, warn_loaded::Bool, already_instantiated::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Pkg.API /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:1432
 [3] precompile
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:1063 [inlined]
 [4] #precompile#225
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:1062 [inlined]
 [5] precompile (repeats 2 times)
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:1062 [inlined]
 [6] top-level scope
   @ none:1

That didn’t help.

pkg> add GR_jll
julia> import GR_jll

should show use the underlying issue.

this gives me syntax error. Anyways I just downloaded the Mac version of Julia from the download web page. Maybe I choose the wrong one for my computer? or maybe, since I uninstall and installed it again few times, could it be that I didn’t delete in the correct way the previous versions that I had and now it’s overlapped in some ways?

or maybe, since I uninstall and installed it again few times, could it be that I didn’t delete in the correct way the previous versions that I had and now it’s overlapped in some ways?

You could also try to delete ~/.julia/artifacts and try again.
GR_jll is an artifact and it might not have been downloaded / installed properly.
After deletion, running pkg> instantiate should download artifacts again.

This command should be run within a terminal shell, not within the Julia REPL. This should start up your Julia session with a new, untouched directory that it can start downloading packages into.

JULIA_DEPOT_PATH="$HOME/tmp/.julia" julia

Sorry for the late reply but as a new member I had a limit of replies I could send in the first day. Anyways in the meantime I also tried to uninstall everything (Julia and atom) again and use VS code instead. But the same error occurs…
By the way, regarding this:

I get as output the following:

(@v1.8) pkg> add GR_jll

   Resolving package versions...
    Updating `~/.julia/environments/v1.8/Project.toml`
  [d2c73de3] + GR_jll v0.69.1+0
  No Changes to `~/.julia/environments/v1.8/Manifest.toml`

julia> import GR_jll
[ Info: Precompiling GR_jll [d2c73de3-f751-5644-a686-071e5b155ba9]
ERROR: LoadError: InitError: could not load library "/Users/matteomassaro/.julia/artifacts/a0db4e704fd0da4298744f012883535d351fa170/lib/QtConcurrent.framework/Versions/5/QtConcurrent"
dlopen(/Users/matteomassaro/.julia/artifacts/a0db4e704fd0da4298744f012883535d351fa170/lib/QtConcurrent.framework/Versions/5/QtConcurrent.dylib, 1): image not found
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__()
    @ Qt5Base_jll ~/.julia/packages/Qt5Base_jll/lpIK6/src/wrappers/x86_64-apple-darwin.jl:31
  [5] _include_from_serialized(pkg::Base.PkgId, path::String, depmods::Vector{Any})
    @ Base ./loading.jl:831
  [6] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt64)
    @ Base ./loading.jl:1039
  [7] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1315
  [8] _require_prelocked(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1200
  [9] macro expansion
    @ ./loading.jl:1180 [inlined]
 [10] macro expansion
    @ ./lock.jl:223 [inlined]
 [11] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1144
 [12] include(mod::Module, _path::String)
    @ Base ./Base.jl:419
 [13] top-level scope
    @ ~/.julia/packages/JLLWrappers/QpMQW/src/toplevel_generators.jl:188
 [14] include
    @ ./Base.jl:419 [inlined]
 [15] 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
 [16] top-level scope
    @ stdin:1
during initialization of module Qt5Base_jll
in expression starting at /Users/matteomassaro/.julia/packages/GR_jll/48Bah/src/wrappers/x86_64-apple-darwin.jl:13
in expression starting at /Users/matteomassaro/.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 /Users/matteomassaro/.julia/compiled/v1.8/GR_jll/jl_CIxsPW.
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:1707
  [3] compilecache
    @ ./loading.jl:1651 [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
  [9] eval
    @ ./boot.jl:368 [inlined]
 [10] eval
    @ ./Base.jl:65 [inlined]
 [11] repleval(m::Module, code::Expr, #unused#::String)
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.36.2/scripts/packages/VSCodeServer/src/repl.jl:222
 [12] (::VSCodeServer.var"#107#109"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.36.2/scripts/packages/VSCodeServer/src/repl.jl:186
 [13] with_logstate(f::Function, logstate::Any)
    @ Base.CoreLogging ./logging.jl:511
 [14] with_logger
    @ ./logging.jl:623 [inlined]
 [15] (::VSCodeServer.var"#106#108"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.36.2/scripts/packages/VSCodeServer/src/repl.jl:187
 [16] #invokelatest#2
    @ ./essentials.jl:729 [inlined]
 [17] invokelatest(::Any)
    @ Base ./essentials.jl:726
 [18] macro expansion
    @ ~/.vscode/extensions/julialang.language-julia-1.36.2/scripts/packages/VSCodeServer/src/eval.jl:34 [inlined]
 [19] (::VSCodeServer.var"#61#62")()
    @ VSCodeServer ./task.jl:484

It looks like I have again the version v.069.1 of GR as opposed to v.069.4
Maybe the uninstall/install process did this. But regardless I had the problem also with the newest version.

this:

didn’t work:(

and neither this:

At least the stacktrace using import GR_jll is helpful.

Are there any files in /Users/matteomassaro/.julia/artifacts/a0db4e704fd0da4298744f012883535d351fa170/lib/... and under ?

This is odd, I cannot find a0db4e704fd0da4298744f012883535d351fa170 in GR_jll.jl/Artifacts.toml at main · JuliaBinaryWrappers/GR_jll.jl · GitHub (it should correspond a git-tree-sha1).

@jheinen might be able to help since he’s on macOS.
I’m a bit clueless now, sorry, since I’m working with linux.

EDIT: found it, the failing lib comes from Qt5Base_jll Qt5Base_jll.jl/Artifacts.toml at 5dd3940b351600d975a1e60973cea2a729919cf3 · JuliaBinaryWrappers/Qt5Base_jll.jl · GitHub.

What shows your versioninfo() ?

1 Like

It appears you are hitting Failing to precompile Plots due to LoadError (Mac edition) - #7 by jeffzwe.

You can open a ticket in Issues · JuliaPackaging/Yggdrasil · GitHub about Yggdrasil/build_tarballs.jl at master · JuliaPackaging/Yggdrasil · GitHub if you seek a solution to this.

And another related issue: Qt-based JLLs fail to precompile on old macOS; affects GR and Plots.jl · Issue #2883 · JuliaPackaging/Yggdrasil · GitHub.

1 Like

Yes there are several files, but I don’t understand what they do.

Regarding:

I get:

julia> versioninfo() 
Julia Version 1.8.2
Commit 36034abf260 (2022-09-29 15:21 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin21.4.0)
  CPU: 4 × Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, broadwell)
  Threads: 1 on 4 virtual cores
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS =

I will then try to open a new ticket in Issues · JuliaPackaging/Yggdrasil · GitHub as you suggested. Are the other two links that you shared : https://github.com/JuliaPackaging/Yggdrasil/blob/master/Q/Qt5Base/build_tarballs.jl and Qt-based JLLs fail to precompile on old macOS; affects GR and Plots.jl · Issue #2883 · JuliaPackaging/Yggdrasil · GitHub
reporting the same issue (or a connected one?)

EDIT: I just realized that my Mac is version 10.13. Could this be the reason of the issue? because in Failing to precompile Plots due to LoadError (Mac edition) they mention that you need at least version 10.14.

EDIT: I just realized that my Mac is version 10.13. Could this be the reason of the issue? because in Failing to precompile Plots due to LoadError (Mac edition) they mention that you need at least version 10.14.

Yes. I could very well imagine that. Experience shows that the backwards compatibility with Qt is often limited to a maximum of 4 OS versions depending on the platform.

2 Likes

This is still broken for me.

Here is my versioninfo():

Julia Version 1.8.2
Commit 36034abf260 (2022-09-29 15:21 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin21.4.0)
  CPU: 4 × Intel(R) Core(TM) i5-6600 CPU @ 3.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
  Threads: 1 on 4 virtual cores

That version of MacOS is 12.6.1–>so maybe mine is too new rather than too old.

Here is the status output for Plots and GR:

(@v1.8) pkg> status -m Plots GR
Status `~/.julia/environments/v1.8/Manifest.toml`
  [28b8d3ca] GR v0.69.5
  [91a5bcdd] Plots v1.35.7

I have manually add’ed GR. I can do using GR, but I don’t know any of its direct commands. using Plots still fails.

I just reinstalled homebrew and had homebrew upgrade everything it had installed, so I have the latest version of QT and QT5:

Qt 5.15.6 (x86_64-little_endian-lp64 shared (dynamic) release build; by Clang 14.0.0 (clang-1400.0.29.102) (Apple)) on "cocoa"

This really didn’t make any difference. The problem is in GR itself.

Solved for me (maybe not for others…).

I ran ] status --outdated -m
and found that Blink was causing several packages to be downgraded. I rm’ed Blink and then both GR and Plots and any package requiring Plots (my own private package) were re-compiled.

Now both GR and Plots work.