Plots and GR_jll is not working and fails to precompile

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

Could you try the following code and report any output?

using Pkg
pkg"add GR_jll"
using GR_jll
Pkg.status()
1 Like

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"

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.

3 Likes

Try the solution I found here:

Basically, execute the following and then restart Julia:

Base.compilecache(Base.identify_package("GR"))
1 Like