Problems with gr()

Dear all,
When I compile

using Plots
import Contour: contours, levels, level, lines, coordinates
f(x,y) = 2 - (x^2 + y^2)
xs = range(-5, stop=5, length=100)
ys = range(-5, stop=5, length=100)
zs = [f(x,y) for y in ys, x in xs]
gr()
contour(xs, ys, zs, levels = [-1.0, 0.0, 1.0])

a big error message apperars and Julia restart. See:

julia> GKS: file open error (C:\Users\Usuário\.julia\packages\GR\RlE5Y\src\..\deps\gr\FONTS\GKSFONT.DAT)
open: No such file or directory
GKS: svgplugin.dll: can't load library, error 126 (0x7e)
GKS: could not open font file: C:\Users\Usuário\.julia\packages\GR\RlE5Y\src\..\deps\gr\FONTS\CMUSerif-Math.ttf
GKS: could not open font file: C:\Users\Usuário\.julia\packages\GR\RlE5Y\src\..\deps\gr\FONTS\DejaVuSans.ttf
GKS: glyph missing from current font: 73
GKS: could not load glyph: 0


Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x5bdf5698 -- gks_ft_get_kerning at C:\Users\Usußrio\.julia\packages\GR\RlE5Y\deps\gr\bin\libGKS.dll (unknown line)
in expression starting at none:0
gks_ft_get_kerning at C:\Users\Usußrio\.julia\packages\GR\RlE5Y\deps\gr\bin\libGKS.dll (unknown line)
gks_ft_get_kerning at C:\Users\Usußrio\.julia\packages\GR\RlE5Y\deps\gr\bin\libGKS.dll (unknown line)
gks_ft_get_kerning at C:\Users\Usußrio\.julia\packages\GR\RlE5Y\deps\gr\bin\libGKS.dll (unknown line)
gks_inq_text_extent at C:\Users\Usußrio\.julia\packages\GR\RlE5Y\deps\gr\bin\libGKS.dll (unknown line)
gr_inqtext at C:\Users\Usußrio\.julia\packages\GR\RlE5Y\deps\gr\bin\libGR.dll (unknown line)
inqtext at C:\Users\Usuário\.julia\packages\GR\RlE5Y\src\GR.jl:663 [inlined]
gr_inqtext at C:\Users\Usuário\.julia\packages\Plots\lmp2A\src\backends\gr.jl:225
gr_text_size at C:\Users\Usuário\.julia\packages\Plots\lmp2A\src\backends\gr.jl:666
gr_get_ticks_size at C:\Users\Usuário\.julia\packages\Plots\lmp2A\src\backends\gr.jl:681
unknown function (ip: 0000000008141730)
_update_min_padding! at C:\Users\Usuário\.julia\packages\Plots\lmp2A\src\backends\gr.jl:830
iterate at .\generator.jl:47
_collect at .\array.jl:699
collect_similar at .\array.jl:628
unknown function (ip: 0000000001c12d44)
map at .\abstractarray.jl:2162
_update_min_padding! at C:\Users\Usuário\.julia\packages\Plots\lmp2A\src\layouts.jl:282
prepare_output at C:\Users\Usuário\.julia\packages\Plots\lmp2A\src\plot.jl:189
showjuno at C:\Users\Usuário\.julia\packages\Plots\lmp2A\src\output.jl:255
show at C:\Users\Usuário\.julia\packages\Plots\lmp2A\src\output.jl:212
unknown function (ip: 000000000813933f)
show at .\multimedia.jl:111
displayinplotpane at C:\Users\Usuário\.julia\packages\Atom\MxsDb\src\display\showdisplay.jl:67
displayandrender at C:\Users\Usuário\.julia\packages\Atom\MxsDb\src\display\showdisplay.jl:131
#204 at C:\Users\Usuário\.julia\packages\Atom\MxsDb\src\eval.jl:138
unknown function (ip: 0000000034199673)
jl_f_tuple at C:\Users\Usußrio\AppData\Local\JuliaPro-1.5.3-1\Julia-1.5.3\bin\libjulia.dll (unknown line)        
jl_f__apply_latest at C:\Users\Usußrio\AppData\Local\JuliaPro-1.5.3-1\Julia-1.5.3\bin\libjulia.dll (unknown line)
#invokelatest#1 at .\essentials.jl:710 [inlined]
invokelatest at .\essentials.jl:709 [inlined]
macro expansion at C:\Users\Usuário\.julia\packages\Media\ItEPc\src\dynamic.jl:24 [inlined]
eval at C:\Users\Usuário\.julia\packages\Atom\MxsDb\src\eval.jl:114
unknown function (ip: 00000000341d9943)
jl_f_tuple at C:\Users\Usußrio\AppData\Local\JuliaPro-1.5.3-1\Julia-1.5.3\bin\libjulia.dll (unknown line)
jl_f__apply_latest at C:\Users\Usußrio\AppData\Local\JuliaPro-1.5.3-1\Julia-1.5.3\bin\libjulia.dll (unknown line)
#invokelatest#1 at .\essentials.jl:710
jl_f_tuple at C:\Users\Usußrio\AppData\Local\JuliaPro-1.5.3-1\Julia-1.5.3\bin\libjulia.dll (unknown line)
invokelatest at .\essentials.jl:709
jl_f_tuple at C:\Users\Usußrio\AppData\Local\JuliaPro-1.5.3-1\Julia-1.5.3\bin\libjulia.dll (unknown line)
macro expansion at C:\Users\Usuário\.julia\packages\Atom\MxsDb\src\eval.jl:41 [inlined]
#184 at .\task.jl:356
unknown function (ip: 000000001dfb7783)
jl_finish_task at C:\Users\Usußrio\AppData\Local\JuliaPro-1.5.3-1\Julia-1.5.3\bin\libjulia.dll (unknown line)
Allocations: 193247357 (Pool: 193177243; Big: 70114); GC: 152

Julia has exited.
Press Enter to start a new session.

I am with JuliaPro version 1.5.3 and using the following packages and its versions:

Status `C:\Users\Usuário\.julia\environments\JuliaPro_v1.5.3-1\Project.toml`
  [c52e3926] Atom v0.12.25 ⚲
  [d38c429a] Contour v0.5.7
  [5789e2e9] FileIO v1.4.5
  [2e9cd046] Gurobi v0.9.7
  [7073ff75] IJulia v1.23.1
  [c601a237] Interact v0.10.3        
  [033835bb] JLD2 v0.3.2
  [4076af6c] JuMP v0.21.5
  [e5e0dc1b] Juno v0.8.4 ⚲
  [2fda8390] LsqFit v0.12.0
  [4722fa14] PkgAuthentication v1.1.0
  [91a5bcdd] Plots v1.10.1
  [44d3d7a6] Weave v0.10.6
  [37e2e46d] LinearAlgebra
  [de0858da] Printf
  [9a3f8284] Random
  [10745b16] Statistics

Thank you for the help.

Have you tried the suggestion from
https://github.com/jheinen/GR.jl/issues/122
which is

Pkg.update("GR")
Pkg.update("Plots")
ENV["GRDIR"]=""
Pkg.build("GR")

Nothing yet. I have executed the codes:

Pkg.update("GR")
Pkg.update("Plots")
ENV["GRDIR"]=""
Pkg.build("GR")

(as you can see in the next print)

But when I compile:

using Plots
gr()
f(x,y) = 2 - (x^2 + y^2)
xs = range(-5, stop=5, length=100)
ys = range(-5, stop=5, length=100)
zs = [f(x,y) for y in ys, x in xs]
contour(xs, ys, zs,level=[1,2])

nothing works. Its terrible. See below:

Could anyone can help me please?

Have you tried this with standard Julia (not JuliaPro) ?

There is difference?
I will try. Many thanks.

If I was using JuliaPro, I would probably send in a support ticket to JuliaComputing. That may be the best route for some users. If I was seeking help from this community forum, I might want to give the community edition a try if everything else is failing just in case. I just use Julia, not JuliaPro so I cannot be sure about the difference.

Could you try to narrow down which line of code produces the error? Is it the call to contour or is it gr() as the title implies?

It is also possible that the issue is actually Juno, the editor, so it may be good to try with Julia outside of Juno.

Could you post the contents of C:\Users\Usuário\.julia\packages\GR\RlE5y\deps\build.log and confirm the existence of C:\Users\Usuário\.julia\packages\GR\RlE5Y\src\..\deps\gr\FONTS\GKSFONT.DAT?

I’ll ping GR author @jheinen in case he can help here.

By the way, I’m not sure exactly what you are doing with the Contour package, but this code works for me:

using Plots
f(x,y) = 2 - (x^2 + y^2)
# You might want to consider `length = 101` or `-5:0.1:5`
xs = range(-5, stop=5, length=100)
ys = range(-5, stop=5, length=100)
zs = [f(x,y) for y in ys, x in xs]
gr()
contour(xs, ys, zs, levels = [-1.0, 0.0, 1.0])

Older version of Plots may not export contour, but this is not your problem at the moment.

1 Like

It might be useful to at least reference your previous post:

Afer inumerous attempts, the error changes. At least after compiling gr() the core is not reset. the error is this:

using Plots
gr()
x=0:0.01:2*π
y=sin.(x)
plot(x,y)
SystemError: opening file "C:\\Users\\USURIO~2\\AppData\\Local\\Temp\\jl_lyXJ1gB2lS.svg": No such file or directory
systemerror(::String, ::Int32; extrainfo::Nothing) at error.jl:168
(::Base.var"#systemerror##kw")(::NamedTuple{(:extrainfo,),Tuple{Nothing}}, ::typeof(systemerror), ::String, ::Int32) at error.jl:168
(::Base.var"#systemerror##kw")(::NamedTuple{(:extrainfo,),Tuple{Nothing}}, ::typeof(systemerror), ::String) at error.jl:168
#systemerror#48 at error.jl:167 [inlined]
systemerror at error.jl:167 [inlined]
open(::String; lock::Bool, read::Bool, write::Nothing, create::Nothing, truncate::Nothing, append::Nothing) at iostream.jl:284
open at iostream.jl:273 [inlined]
open(::String, ::String; lock::Bool) at iostream.jl:346
open at iostream.jl:346 [inlined]
_readfile(::String) at GR.jl:3342
show() at GR.jl:3401
plot_data(::Bool) at jlgr.jl:1380
plot_data at jlgr.jl:1061 [inlined]
plot(::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::Vararg{Union{AbstractString, Function, AbstractArray{T,2} where T, AbstractArray{T,1} where T},N} where N; kv::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at jlgr.jl:1583
plot(::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::Vararg{Union{AbstractString, Function, AbstractArray{T,2} where T, AbstractArray{T,1} where T},N} where N) at jlgr.jl:1575
plot(::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::Vararg{Any,N} where N; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at GR.jl:3281
plot(::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::Vararg{Any,N} where N) at GR.jl:3281
top-level scope at Manipulacoes.jl:26

Anyone may help me please?

1 Like

Is this resolved by your other issue?

Hi. I have the same issue ‘GKS: file open error’. I just installed Julia 1.6.3, 64 bit, on Win 10.

I see that OP’s windows user profile is Usuário in ‘C:\Users\Usuário\ .julia’. My profile is ‘Bärbara’, that is 'C:\Users\Bärbara\ .julia'.

‘using Plots; gr()’ works fine on my other computer, where I also just installed Julia.

Perhaps the issue is with the somewhat unusual letters?

1 Like

I reformatted the computer with a new user name and now it works fine. Alternatively, browse for how to rename user folder in Windows 10.

1 Like