# Plots and GR\_jll is not working and fails to precompile

**URL:** <https://discourse.julialang.org/t/plots-and-gr-jll-is-not-working-and-fails-to-precompile/89657>\
**Category:** New to Julia\
**Tags:** plotting\
**Created:** [November 2, 2022, 12:54pm UTC](https://discourse.julialang.org/t/plots-and-gr-jll-is-not-working-and-fails-to-precompile/89657 "2022-11-02T12:54:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Engineering\_Science](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/engineering_science/32/44030_2.png) [@Engineering\_Science](https://discourse.julialang.org/u/Engineering_Science)\
**Post date:** [November 2, 2022, 12:54pm UTC](https://discourse.julialang.org/t/plots-and-gr-jll-is-not-working-and-fails-to-precompile/89657/1 "2022-11-02T12:54:01Z")

</div>

Hello

I am trying to use julia for my Linear Algebra and Multivariable Calculus courses that requires plotting, however I cannot seem to get the package to work. I have read all the other plotting post as well as stack overflow and other place, but I cannot seem to find a solution. I have updated packages and registers, built, removed, reinstalled, installed with other packages, precompiled packages and many other things but I cannot get it to work. Please can someone help. Your assistance would be greatly appreciated. Please see below program code and the error messages on my machine.

PROGRAM CODE: -------------

import Pkg;

Pkg.add(“Plots”);

using Plots;

f(x) = sin(x);

plot(f,0,2\*pi,title=“First Graph”,xlabe = “x”, ylabel = “y”);

g(x) = cos(x);

# list of two functions f and g included in the plot

plot([f,g],0,2\*pi,title=“First Graph”,xlabe = “x”, ylabel = “y”);

savefig(“firstgraph.pdf”);

* * *

ERORR MESSAGES: ----------------------------------------------------

ERROR: LoadError: InitError: UndefVarError: GR\_jll not defined  
Stacktrace:  
[1] **init** ()  
@ GR.GRPreferences C:\Users\Tshepho.julia\packages\GR\uzy0J\src\preferences.jl:36  
[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 C:\Users\Tshepho.julia\packages\Plots\jqILG\src\Plots.jl:1  
[11] top-level scope  
@ C:\Users\Tshepho.julia\packages\Plots\jqILG\src\Plots.jl:202  
[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::String)  
@ Base .\loading.jl:1554  
[14] top-level scope  
@ stdin:1  
during initialization of module GRPreferences  
in expression starting at C:\Users\Tshepho.julia\packages\Plots\jqILG\src\backends\gr.jl:3  
in expression starting at C:\Users\Tshepho.julia\packages\Plots\jqILG\src\Plots.jl:1  
in expression starting at stdin:1  
ERROR: LoadError: Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to C:\Users\Tshepho.julia\compiled\v1.8\Plots\jl\_CFA0.tmp.  
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] include(fname::String)  
@ Base.MainInclude .\client.jl:476  
[10] top-level scope  
@ REPL[4]:1  
in expression starting at C:\Users\Tshepho\Documents\4. Computational Methods\Math Computer Languages\Julia-Workshop\graphing.jl:3

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [November 4, 2022, 9:05am UTC](https://discourse.julialang.org/t/plots-and-gr-jll-is-not-working-and-fails-to-precompile/89657/2 "2022-11-04T09:05:37Z")

</div>

Could you try the following code and report any output?

```julia
using Pkg
pkg"add GR_jll"
using GR_jll
Pkg.status()

```

---

<div class="post-metadata">

**Author:** ![Engineering\_Science](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/engineering_science/32/44030_2.png) [@Engineering\_Science](https://discourse.julialang.org/u/Engineering_Science)\
**Post date:** [November 4, 2022, 1:57pm UTC](https://discourse.julialang.org/t/plots-and-gr-jll-is-not-working-and-fails-to-precompile/89657/3 "2022-11-04T13:57:40Z")

</div>

Hello

It did not work. Please see below.

**CODE**  
I updated the code as follows:

"import Pkg;

Pkg.add(“Plots”);

Pkg.add(“GR\_jll”);

using GR\_jll;

using Plots;

Pkg.status()

f(x) = sin(x);

plot(f,0,2\*pi,title=“First Graph”,xlabe = “x”, ylabel = “y”);

g(x) = cos(x);

# list of two functions f and g included in the plot

plot([f,g],0,2\*pi,title=“First Graph”,xlabe = “x”, ylabel = “y”);

savefig(“firstgraph.pdf”);"

_ **ERROR MESSAGE** _  
The error message is as follows:

" Updating registry at `C:\Users\Tshepho\.julia\registries\General.toml`  
Resolving package versions…  
No Changes to `C:\Users\Tshepho\.julia\environments\v1.8\Project.toml`  
No Changes to `C:\Users\Tshepho\.julia\environments\v1.8\Manifest.toml`  
Resolving package versions…  
No Changes to `C:\Users\Tshepho\.julia\environments\v1.8\Project.toml`  
No Changes to `C:\Users\Tshepho\.julia\environments\v1.8\Manifest.toml`  
ERROR: LoadError: InitError: could not load library “C:\Users\Tshepho.julia\artifacts\c3712e14d6f387fa0a6d1509acbdd4b8976e87d1\bin\Qt5Concurrent.dll”  
The specified module could not be 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  
@ C:\Users\Tshepho.julia\packages\JLLWrappers\QpMQW\src\products\library\_generators.jl:54 [inlined]  
[4] **init** ()  
@ Qt5Base\_jll C:\Users\Tshepho.julia\packages\Qt5Base\_jll\lpIK6\src\wrappers\x86\_64-w64-mingw32-cxx11.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  
@ C:\Users\Tshepho.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::String)  
@ Base .\loading.jl:1554  
[16] top-level scope  
@ stdin:1  
during initialization of module Qt5Base\_jll  
in expression starting at C:\Users\Tshepho.julia\packages\GR\_jll\48Bah\src\wrappers\x86\_64-w64-mingw32-cxx11.jl:13  
in expression starting at C:\Users\Tshepho.julia\packages\GR\_jll\48Bah\src\GR\_jll.jl:2  
in expression starting at stdin:1  
ERROR: LoadError: Failed to precompile GR\_jll [d2c73de3-f751-5644-a686-071e5b155ba9] to C:\Users\Tshepho.julia\compiled\v1.8\GR\_jll\jl\_FCD7.tmp.  
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  
in expression starting at c:\Users\Tshepho\Documents\4. Computational Methods\Math Computer Languages\Julia-Workshop\graphing.jl:4"

---

<div class="post-metadata">

**Author:** ![t-bltg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/t-bltg/32/25526_2.png) [@t-bltg](https://discourse.julialang.org/u/t-bltg)\
**Post date:** [November 4, 2022, 5:02pm UTC](https://discourse.julialang.org/t/plots-and-gr-jll-is-not-working-and-fails-to-precompile/89657/4 "2022-11-04T17:02:12Z")

</div>

Probably a failed download.

Delete `C:\Users\Tshepho.julia\artifacts\c3712e14d6f387fa0a6d1509acbdd4b8976e87d1` manually, then run `using Pkg; pkg"instantiate"`, it should download the failing artifact again.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [August 3, 2023, 3:06pm UTC](https://discourse.julialang.org/t/plots-and-gr-jll-is-not-working-and-fails-to-precompile/89657/5 "2023-08-03T15:06:50Z")

</div>

Try the solution I found here:

> [@Plots, InitError: UndefVarError: GR\_jll not defined](https://discourse.julialang.org/t/plots-initerror-undefvarerror-gr-jll-not-defined/102448):
>
> In some circumstances, a user may encounter the following error. Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to "~/.julia/compiled/v1.9/Plots/jl\_crbDAx". ERROR: LoadError: InitError: UndefVarError: `GR_jll` not defined Stacktrace: [1] \_\_init\_\_() @ GR.GRPreferences ~/.julia/packages/GR/jehu0/src/preferences.jl:64

Basically, execute the following and then restart Julia:

```julia
Base.compilecache(Base.identify_package("GR"))

```
