Problem upgrading GR package

Thanks for providing a bugfix. Unfortunately I can’t test it, because after upgrading QuadGK, I find that something in my Julia installation is broken. When running the program I was working on, I get this error:

Your GR installation is incomplete. Rerunning build step for GR package.
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/4DHy8/src/GR.jl:351
  [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/vVVub/src/Plots.jl:1
 [10] top-level scope
    @ ~/.julia/packages/Plots/vVVub/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::String)
    @ 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

Is there any possibility that this has to do with the upgrade (though I can’t imagine how)? And how do I fix this?

The GR package is unrelated to QuadGK—you apparently upgraded other packages accidentally. I’ve moved your post to a new topic in case others can advise on your upgrade problem.

It might be helpful if you report the pkg> status output.

Thanks for branching this off. The status output is:

julia> Pkg.status()
      Status `~/.julia/environments/v1.6/Project.toml`
  [c52e3926] Atom v0.12.32
  [442a2c76] FastGaussQuadrature v0.4.7
  [34004b35] HypergeometricFunctions v0.3.5
  [7073ff75] IJulia v1.23.2
  [d1acc4aa] IntervalArithmetic v0.18.2
  [d2bf35a9] IntervalRootFinding v0.5.7
  [682c06a0] JSON v0.21.2
  [e5e0dc1b] Juno v0.8.4
  [b964fa9f] LaTeXStrings v1.2.1
  [91a5bcdd] Plots v1.14.0
  [3a141323] PolynomialRoots v1.0.0
  [1fd47b50] QuadGK v2.4.2
  [f2b01f46] Roots v1.0.9
  [276daf66] SpecialFunctions v1.3.0

so it’s not only my specific program but indeed something with the installation in general.

The latest Plots version is 1.22.0, so something in your environment is holding you back from updating. Do ] add Plots@1.22 to see what it is. Incidentally, don’t stick all your packages into the default environments, but use project specific environments to minimise version clashes (and ensure reproducibility of your analyses).

2 Likes

Ok, I did ] add Plots@1.22, but got

Precompiling project...
  ? CodeTools
  ? Atom
  ✗ Plots
  14 dependencies successfully precompiled in 20 seconds (169 already precompiled)
  2 dependencies failed but may be precompilable after restarting julia
  1 dependency errored. To see a full report either run `import Pkg; Pkg.precompile()` or load the package

in the end. When precompiling as suggested in this output, I get

Precompiling project...
  ✗ Plots
  ? Atom
  1 dependency successfully precompiled in 8 seconds (183 already precompiled)
  1 dependency failed but may be precompilable after restarting julia

ERROR: The following 1 direct dependency failed to precompile:

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

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/4DHy8/src/GR.jl:351
  [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/S30zV/src/Plots.jl:1
 [10] top-level scope
    @ ~/.julia/packages/Plots/S30zV/src/Plots.jl:230
 [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 /Users/ruedas/.julia/packages/Plots/S30zV/src/backends/gr.jl:6
in expression starting at /Users/ruedas/.julia/packages/Plots/S30zV/src/Plots.jl:1
Stacktrace:
 [1] pkgerror(msg::String)
   @ Pkg.Types /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Types.jl:55
 [2] precompile(ctx::Pkg.Types.Context; internal_call::Bool, strict::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Pkg.API /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:1244
 [3] precompile
   @ /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:920 [inlined]
 [4] #precompile#196
   @ /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:918 [inlined]
 [5] precompile()
   @ Pkg.API /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:918
 [6] top-level scope
   @ none:1

I have no clue where this “evaluation into the closed module GR” could take place, let alone how.

As I couldn’t resolve the issue, I have uninstalled Julia and reinstalled it (upgrading from 1.6.1 to 1.6.2 in the process), but the problem with Plots and GR is still there, and the error messages don’t give me too much usable information how I can remove the “evaluation into the closed module GR” mentioned above. So what can I do? Should I delete the entire ~/.julia/1.6 directory or the directories of earlier versions? I’m still not that familiar with these technicalities of Julia, but I currently use it for a major project, so it’s really important for me to get it working again.
Here’s how my setup looks like: Mac M1 with Big Sur 11.5.2, Julia 1.6.2 installed as a Homebrew cask. For editing and package managing I use the REPL from Atom, from where I also launch Jupyter to load notebooks. Julia programs are either run from the terminal (not REPL) command line or as notebooks.

I would just add Plots to a new environment and see if the problem persists.

Sorry for this really stupid question, but what do you mean with “new environment”? When I install a package with the package manager (in Atom’s REPL), it just goes somewhere and I don’t know where things end up. (Ultimately, apparently, they all end up in my ~/.julia subdirectories.)
Is there something where I can read up on this?

https://pkgdocs.julialang.org/dev/environments/

1 Like

It may be necessary to add GR to a temporary environment and build it explicitly. If GR is trying to eval into itself, then it’s encountered some issue with finding the underlying native library and is trying to self-repair.

The follow steps are done in the REPL’s pkg mode. The ] should enter the Pkg mode.

] activate --temp
add GR # This should attempt to build GR
build GR # This might then rebuild GR should the above fail

Does this still fail? If so, please show us this stacktrace.

Frankly, I lost my patience with this mess, erased my Julia and the contents of ~/.julia and reinstalled everything from scratch, recreating the setup I had before things went wrong, i.e. without setting up temporary environments. Now it works again, so I really can’t tell what went wrong exactly.
Nonetheless, thanks for taking the trouble to comment.

Thanks a lot for your discussion here. I also had the same problem and wasted amounts of hours in solving the issue, which turned out to be useless. Following your suggestion, I think removing all the Julia directories and reinstalling are the best option. I guess that the error of precompiling Plots may arise from the imperfect installation of other packages like GR. Hope this will help resolve precompile issue of Plots.