# "LoadError: InitError: Evaluation into the closed module \`GR\` breaks incremental compilation..."

**URL:** <https://discourse.julialang.org/t/loaderror-initerror-evaluation-into-the-closed-module-gr-breaks-incremental-compilation/53637>\
**Category:** General Usage\
**Tags:** error, plots, gr\
**Created:** [January 19, 2021, 8:24pm UTC](https://discourse.julialang.org/t/loaderror-initerror-evaluation-into-the-closed-module-gr-breaks-incremental-compilation/53637 "2021-01-19T20:24:11Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Barmann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/michael_barmann/32/20389_2.png) [@Michael\_Barmann](https://discourse.julialang.org/u/Michael_Barmann)\
**Post date:** [January 19, 2021, 8:24pm UTC](https://discourse.julialang.org/t/loaderror-initerror-evaluation-into-the-closed-module-gr-breaks-incremental-compilation/53637/1 "2021-01-19T20:24:11Z")

</div>

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:

```julia
┌ 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):

```julia
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")

```

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [January 20, 2021, 7:47am UTC](https://discourse.julialang.org/t/loaderror-initerror-evaluation-into-the-closed-module-gr-breaks-incremental-compilation/53637/2 "2021-01-20T07:47:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Michael\_Barmann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/michael_barmann/32/20389_2.png) [@Michael\_Barmann](https://discourse.julialang.org/u/Michael_Barmann)\
**Post date:** [January 20, 2021, 10:40pm UTC](https://discourse.julialang.org/t/loaderror-initerror-evaluation-into-the-closed-module-gr-breaks-incremental-compilation/53637/3 "2021-01-20T22:40:45Z")

</div>

Thanks, `]build Plots` did it! That was an easy fix!

And good to know about `gr()`.

---

<div class="post-metadata">

**Author:** ![tp2750](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tp2750/32/207806_2.png) [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Post date:** [February 12, 2021, 11:43am UTC](https://discourse.julialang.org/t/loaderror-initerror-evaluation-into-the-closed-module-gr-breaks-incremental-compilation/53637/4 "2021-02-12T11:43:37Z")

</div>

I had the same problem.  
Rebuilding Plots and GR did not help.  
I needed to set a fresh depot with JULIA\_DEPOT\_PATH=/some/path

---

<div class="post-metadata">

**Author:** ![Michael\_Barmann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/michael_barmann/32/20389_2.png) [@Michael\_Barmann](https://discourse.julialang.org/u/Michael_Barmann)\
**Post date:** [February 14, 2021, 7:37pm UTC](https://discourse.julialang.org/t/loaderror-initerror-evaluation-into-the-closed-module-gr-breaks-incremental-compilation/53637/5 "2021-02-14T19:37:00Z")

</div>

Interesting…glad you found a solution.

---

<div class="post-metadata">

**Author:** ![Tim\_G](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim_g/32/11039_2.png) [@Tim\_G](https://discourse.julialang.org/u/Tim_G)\
**Post date:** [April 6, 2021, 4:08am UTC](https://discourse.julialang.org/t/loaderror-initerror-evaluation-into-the-closed-module-gr-breaks-incremental-compilation/53637/6 "2021-04-06T04:08:40Z")

</div>

Rebuilding Plots and GR did not help me either.

Apparently, I have three depot paths:

```julia
julia> DEPOT_PATH
3-element Vector{String}:
 "/home/timothy/.julia"
 "/home/timothy/julia-1.6.0/local/share/julia"
 "/home/timothy/julia-1.6.0/share/julia"

```

The two paths:

`/home/timothy/.julia`  
and  
`/home/timothy/julia-1.6.0/share/julia`

exist, but:  
`/home/timothy/julia-1.6.0/local/share/julia`  
does not.

I am unsure of _exactly_ how I should proceed.

Should I delete  
`/home/timothy/julia-1.6.0/local/share/julia`  
from the depot path array? And if so, do you know where and how I do that?

---

<div class="post-metadata">

**Author:** ![tp2750](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tp2750/32/207806_2.png) [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Post date:** [April 6, 2021, 6:27am UTC](https://discourse.julialang.org/t/loaderror-initerror-evaluation-into-the-closed-module-gr-breaks-incremental-compilation/53637/7 "2021-04-06T06:27:23Z")

</div>

This is how I set a fresh depot:

```julia
JULIA_DEPOT_PATH=~/.julia/julia-1.6.0_depot julia

```

Where I make sure `~/.julia/julia-1.6.0_depot` exists.

Then that is the one being used:

```julia
julia> DEPOT_PATH
1-element Vector{String}:
 "~/.julia/julia-1.6.0_depot"

```

---

<div class="post-metadata">

**Author:** ![Tim\_G](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim_g/32/11039_2.png) [@Tim\_G](https://discourse.julialang.org/u/Tim_G)\
**Post date:** [April 6, 2021, 7:26am UTC](https://discourse.julialang.org/t/loaderror-initerror-evaluation-into-the-closed-module-gr-breaks-incremental-compilation/53637/8 "2021-04-06T07:26:30Z")

</div>

With two `pop!()`s and a `push!()` in the REPL, I had fixed my DEPOT\_PATH to have only the two existing paths:

```julia
julia> DEPOT_PATH
2-element Vector{String}:
 "/home/timothy/.julia"
 "/home/timothy/julia-1.6.0/share/julia"

```

But had still received the `"Your GR installation is incomplete."` message.

So you had first created a new file and then set JULIA\_DEPOT\_PATH somewhere other than the REPL?

If nothing else works, I will consider [completely reinstalling Julia](http://www2.math.uu.se/~xinca341/reinstall-julia.html).

---

<div class="post-metadata">

**Author:** ![tp2750](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tp2750/32/207806_2.png) [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Post date:** [April 6, 2021, 8:08am UTC](https://discourse.julialang.org/t/loaderror-initerror-evaluation-into-the-closed-module-gr-breaks-incremental-compilation/53637/9 "2021-04-06T08:08:26Z")

</div>

Hi @Tim_G

I start julia from the commandline (Ubuntu/Linux).

So in a shell I create the folder:

```julia
$ mkdir ~/.julia/julia-1.6.0_depot

```

Then I start julia from a shell:

```julia
$ JULIA_DEPOT_PATH=~/.julia/julia-1.6.0_depot julia

```

You can also do it in 2 lines by “exporting” the environment variable.  
In bash I do:

```julia
$ export JULIA_DEPOT_PATH="~/.julia/julia-1.6.0_depot"
$ julia

```

---

<div class="post-metadata">

**Author:** ![Tim\_G](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim_g/32/11039_2.png) [@Tim\_G](https://discourse.julialang.org/u/Tim_G)\
**Post date:** [April 6, 2021, 6:31pm UTC](https://discourse.julialang.org/t/loaderror-initerror-evaluation-into-the-closed-module-gr-breaks-incremental-compilation/53637/10 "2021-04-06T18:31:51Z")

</div>

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](https://discourse.julialang.org/t/help-plots-not-loading/49941/47) was deleting what was in the ~.julia\compiled\v1.6\GR file.

---

<div class="post-metadata">

**Author:** ![bojeryd91](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bojeryd91/32/42622_2.png) [@bojeryd91](https://discourse.julialang.org/u/bojeryd91)\
**Post date:** [April 7, 2021, 3:18pm UTC](https://discourse.julialang.org/t/loaderror-initerror-evaluation-into-the-closed-module-gr-breaks-incremental-compilation/53637/11 "2021-04-07T15:18:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rubgb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rubgb/32/22596_2.png) [@rubgb](https://discourse.julialang.org/u/rubgb)\
**Post date:** [April 19, 2021, 8:12am UTC](https://discourse.julialang.org/t/loaderror-initerror-evaluation-into-the-closed-module-gr-breaks-incremental-compilation/53637/12 "2021-04-19T08:12:11Z")

</div>

Thank you! “add Plots@1.6.11” did the trick for me with Julia 1.5.1

---

<div class="post-metadata">

**Author:** ![LSellers](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lsellers/32/25221_2.png) [@LSellers](https://discourse.julialang.org/u/LSellers)\
**Post date:** [June 8, 2021, 9:30pm UTC](https://discourse.julialang.org/t/loaderror-initerror-evaluation-into-the-closed-module-gr-breaks-incremental-compilation/53637/13 "2021-06-08T21:30:24Z")

</div>

This finally worked for me.

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?

thanks
