I installed Plots with the gr() back end several weeks ago, and it had been working fine up until today. I shutdown the kernel yesterday evening after I was done working on my Jupyter notebook, and when I restarted it today and attempted to compile Plots; gr(), along with my other packages, I got the following error:
┌ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
└ @ Base loading.jl:1278
Your GR installation is incomplete. Rerun 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 at .\boot.jl:331 [inlined]
[2] __init__() at C:\Users\Michael\.julia\packages\GR\RlE5Y\src\GR.jl:274
[3] _include_from_serialized(::String, ::Array{Any,1}) at .\loading.jl:697
[4] _require_search_from_serialized(::Base.PkgId, ::String) at .\loading.jl:782
[5] _require(::Base.PkgId) at .\loading.jl:1007
[6] require(::Base.PkgId) at .\loading.jl:928
[7] require(::Module, ::Symbol) at .\loading.jl:923
[8] include(::Function, ::Module, ::String) at .\Base.jl:380
[9] include at .\Base.jl:368 [inlined]
[10] include(::String) at C:\Users\Michael\.julia\packages\Plots\lmp2A\src\Plots.jl:1
[11] top-level scope at C:\Users\Michael\.julia\packages\Plots\lmp2A\src\Plots.jl:212
[12] include(::Function, ::Module, ::String) at .\Base.jl:380
[13] include(::Module, ::String) at .\Base.jl:368
[14] top-level scope at none:2
[15] eval at .\boot.jl:331 [inlined]
[16] eval(::Expr) at .\client.jl:467
[17] top-level scope at .\none:3
during initialization of module GR
in expression starting at C:\Users\Michael\.julia\packages\Plots\lmp2A\src\backends\gr.jl:6
in expression starting at C:\Users\Michael\.julia\packages\Plots\lmp2A\src\Plots.jl:212
I have no idea what’s going on here. I tried uninstalling and then reinstalling Plots using Pkg.rm("Plots"), followed by Pkg.add("Plots") and Pkg.add("GR"), but I got the same error again when I attempted to precompile. Does anyone know what’s causing this issue/how to fix it?
In case it matters, here are all of the packages I was trying to compile (plus two notebooks I was importing):
using Pkg
using Plots; gr()
using XLSX
using Dates
using DataFrames
using DifferentialEquations
using Statistics
using Random
using ForwardDiff
using NLopt
using LinearAlgebra
using Optim
using NBInclude
using Printf
@nbinclude("ODE_models.ipynb")
@nbinclude("Norm_functions.ipynb")
Have you tried ]build Plots as the error message suggests? What happens?
Also note that you don’t have to explicitly ]add GR as a package or call gr() when using Plots, GR is the default backend so will be installed upon installation of Plots and activated once you use Plots.
Thank you for your time and for introducing me to Julia’s environment variables. I will have to look into them more. I encountered some other compilation issue when trying to launch a Pluto notebook using Plots.jl (sorry to say I cannot recall the exact details). What worked for me, after reading ChunXi Zhang’s post was deleting what was in the ~.julia\compiled\v1.6\GR file.
I got the same error after updating all my packages. I didn’t try the “fresh depot approach” but removed Plots and reinstalled v1.6.11 using ] add Plots@1.6.11
Now everything works as before
what was happening here? I see people have had this issue on & off for three years. Where does this have to be “fixed” in order for the issue to not occur again?