# Problems with gr()

**URL:** <https://discourse.julialang.org/t/problems-with-gr/53910>\
**Category:** New to Julia\
**Tags:** gr\
**Created:** [January 25, 2021, 1:59pm UTC](https://discourse.julialang.org/t/problems-with-gr/53910 "2021-01-25T13:59:26Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![angeloaliano1](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Post date:** [January 25, 2021, 1:59pm UTC](https://discourse.julialang.org/t/problems-with-gr/53910/1 "2021-01-25T13:59:26Z")

</div>

Dear all,  
When I compile

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

```julia
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.

---

<div class="post-metadata">

**Author:** ![hendri54](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hendri54/32/9621_2.png) [@hendri54](https://discourse.julialang.org/u/hendri54)\
**Post date:** [January 25, 2021, 8:58pm UTC](https://discourse.julialang.org/t/problems-with-gr/53910/2 "2021-01-25T20:58:58Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![angeloaliano1](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Post date:** [January 25, 2021, 9:20pm UTC](https://discourse.julialang.org/t/problems-with-gr/53910/3 "2021-01-25T21:20:48Z")

</div>

Nothing yet. I have executed the codes:

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

```

(as you can see in the next print)

 ![print1](https://global.discourse-cdn.com/julialang/original/3X/9/b/9bc41e72de7e9f0abac89fa16504c4630d2f99b9.png)

But when I compile:

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

 ![print2](https://global.discourse-cdn.com/julialang/original/3X/6/3/635002940f269f7e8b5e7a149d9419f1207871f7.png)

Could anyone can help me please?

---

<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:** [January 25, 2021, 9:37pm UTC](https://discourse.julialang.org/t/problems-with-gr/53910/4 "2021-01-25T21:37:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![angeloaliano1](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Post date:** [January 25, 2021, 9:47pm UTC](https://discourse.julialang.org/t/problems-with-gr/53910/5 "2021-01-25T21:47:11Z")

</div>

There is difference?  
I will try. Many thanks.

---

<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:** [January 25, 2021, 11:44pm UTC](https://discourse.julialang.org/t/problems-with-gr/53910/6 "2021-01-25T23:44:26Z")

</div>

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:

```julia
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.

---

<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:** [January 25, 2021, 11:47pm UTC](https://discourse.julialang.org/t/problems-with-gr/53910/7 "2021-01-25T23:47:08Z")

</div>

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

> [@Problems with level curves](https://discourse.julialang.org/t/problems-with-level-curves/51488/10):
>
> There is something broken in your installation. The only thing I can suggest is to remove completely Plots and GR and install them again.

---

<div class="post-metadata">

**Author:** ![angeloaliano1](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Post date:** [January 26, 2021, 1:36pm UTC](https://discourse.julialang.org/t/problems-with-gr/53910/10 "2021-01-26T13:36:17Z")

</div>

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

```julia
using Plots
gr()
x=0:0.01:2*π
y=sin.(x)
plot(x,y)

```

```julia
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?

---

<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:** [January 28, 2021, 4:42am UTC](https://discourse.julialang.org/t/problems-with-gr/53910/11 "2021-01-28T04:42:56Z")

</div>

Is this resolved by your other issue?

> [@Change local of instalation of \\.julia](https://discourse.julialang.org/t/change-local-of-instalation-of-julia/54010/7):
>
> The set syntax is specific to Windows batch scripting in the command prompt cmd.exe. Within Julia, you just need to manipulate the DEPOT\_PATH array: julia\> DEPOT\_PATH 3-element Array{String,1}: "C:\\Users\\kittisopikulm\\.julia" "C:\\Users\\kittisopikulm\\AppData\\Local\\Programs\\Julia 1.5.0\\local\\share\\julia" "C:\\Users\\kittisopikulm\\AppData\\Local\\Programs\\Julia 1.5.0\\share\\julia" julia\> DEPOT\_PATH[2] "C:\\Users\\kittisopikulm\\AppData\\Local\\Programs\\Julia 1.5.0\\local\\shar…

---

<div class="post-metadata">

**Author:** ![cihset](https://avatars.discourse-cdn.com/v4/letter/c/5fc32e/32.png) [@cihset](https://discourse.julialang.org/u/cihset)\
**Post date:** [September 25, 2021, 2:27pm UTC](https://discourse.julialang.org/t/problems-with-gr/53910/12 "2021-09-25T14:27:25Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![cihset](https://avatars.discourse-cdn.com/v4/letter/c/5fc32e/32.png) [@cihset](https://discourse.julialang.org/u/cihset)\
**Post date:** [September 28, 2021, 5:26pm UTC](https://discourse.julialang.org/t/problems-with-gr/53910/13 "2021-09-28T17:26:59Z")

</div>

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.
