# Simple plotting, I am getting \*could not load library "libGR.so"\*

**URL:** <https://discourse.julialang.org/t/simple-plotting-i-am-getting-could-not-load-library-libgr-so/48611>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [October 19, 2020, 8:21am UTC](https://discourse.julialang.org/t/simple-plotting-i-am-getting-could-not-load-library-libgr-so/48611 "2020-10-19T08:21:15Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![mausam614](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@mausam614](https://discourse.julialang.org/u/mausam614)\
**Post date:** [October 19, 2020, 8:21am UTC](https://discourse.julialang.org/t/simple-plotting-i-am-getting-could-not-load-library-libgr-so/48611/1 "2020-10-19T08:21:15Z")

</div>

Hello Julia experts,  
Please help me get a plot.  
I am almost done with my first assignment using Julia and got to a stage where I need at least a plot.  
My code for the plotting is:  
x = Rating\_count.Ratings; y = Rating\_count.count;  
plot(x, y, title = “The great title.”,  
label = [“Number of something”], lw =3)  
xlabel!(“Ratings”)  
ylabel!(“Count of something”)

and I get:

 ![Screen Shot 2020-10-19 at 9.12.20 PM](https://global.discourse-cdn.com/julialang/original/3X/0/4/04dec47b3f003cbbd90845db6d8c28742d6bf1bb.png)

---

<div class="post-metadata">

**Author:** ![davide](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davide/32/52136_2.png) [@davide](https://discourse.julialang.org/u/davide)\
**Post date:** [October 19, 2020, 9:21am UTC](https://discourse.julialang.org/t/simple-plotting-i-am-getting-could-not-load-library-libgr-so/48611/2 "2020-10-19T09:21:08Z")

</div>

Hi @mausam614,

to use the GR backend you also need the GR package.  
Did you added it?:

```julia
Pkg.add("GR")

```

---

<div class="post-metadata">

**Author:** ![mausam614](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@mausam614](https://discourse.julialang.org/u/mausam614)\
**Post date:** [October 19, 2020, 9:24am UTC](https://discourse.julialang.org/t/simple-plotting-i-am-getting-could-not-load-library-libgr-so/48611/3 "2020-10-19T09:24:56Z")

</div>

> [@davide](#):
>
> `Pkg.add("GR")`

Not earlier but I used it now,

Pkg.add(“GR”)  
Pkg.add(“Plots”)  
Pkg.add(“StatsPlots”)  
using StatsPlots  
using GR  
using Plots

I am getting the same message.

Appreciate your help.

---

<div class="post-metadata">

**Author:** ![davide](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davide/32/52136_2.png) [@davide](https://discourse.julialang.org/u/davide)\
**Post date:** [October 19, 2020, 9:35am UTC](https://discourse.julialang.org/t/simple-plotting-i-am-getting-could-not-load-library-libgr-so/48611/4 "2020-10-19T09:35:18Z")

</div>

To properly install GR, have a look here:  
[https://gr-framework.org/julia.html#installation](https://gr-framework.org/julia.html#installation)

Note also that to get a plot through StatsPlots all you need is using StatsPlots, so, you install the packages:

```julia
Pkg.add(“GR”)
Pkg.add(“Plots”)
Pkg.add(“StatsPlots”)

```

Then:  
`using StatsPlots`

---

<div class="post-metadata">

**Author:** ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)\
**Post date:** [October 19, 2020, 9:50am UTC](https://discourse.julialang.org/t/simple-plotting-i-am-getting-could-not-load-library-libgr-so/48611/5 "2020-10-19T09:50:20Z")

</div>

The GR run-time is probably missing:

```julia
ENV["GRDIR"]=""
] build GR

```

---

<div class="post-metadata">

**Author:** ![mausam614](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@mausam614](https://discourse.julialang.org/u/mausam614)\
**Post date:** [October 19, 2020, 9:58am UTC](https://discourse.julialang.org/t/simple-plotting-i-am-getting-could-not-load-library-libgr-so/48611/6 "2020-10-19T09:58:09Z")

</div>

Thank you so much.

---

<div class="post-metadata">

**Author:** ![mausam614](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@mausam614](https://discourse.julialang.org/u/mausam614)\
**Post date:** [October 19, 2020, 9:58am UTC](https://discourse.julialang.org/t/simple-plotting-i-am-getting-could-not-load-library-libgr-so/48611/7 "2020-10-19T09:58:32Z")

</div>

Solved, thanks a lot.

---

<div class="post-metadata">

**Author:** ![bwanab](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bwanab/32/35903_2.png) [@bwanab](https://discourse.julialang.org/u/bwanab)\
**Post date:** [July 16, 2022, 2:47pm UTC](https://discourse.julialang.org/t/simple-plotting-i-am-getting-could-not-load-library-libgr-so/48611/8 "2022-07-16T14:47:08Z")

</div>

This is weird. I’ve been using 1.7.3 since it arrived. I use plotting every day on around 100 Pluto notebooks. I haven’t changed configurations. I last used Pluto and plotting 2 days ago, but this morning I sat down to do some work and got this on the first Pluto notebook I opened:

Failed to show value:  
could not load library “libGR.so”  
dlopen(libGR.so.dylib, 0x0001): tried: ‘/Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libGR.so.dylib’ (no such file), …

Following the advice in this thread I’ve tried:

1. ENV[“GRDIR”] = “”  
Pkg.build(“GR”)

This didn’t help.

1. restart Julia, then ] update

Still same problem.

Here is the output from:

julia\> using GR

julia\> readdir(joinpath(ENV[“GRDIR”], “lib”))  
23-element Vector{String}:  
“aggplugin.so”  
“cairoplugin.so”  
“glplugin.so”  
“gr.js”  
“gsplugin.so”  
“gtkplugin.so”  
“libGKS.dylib”  
“libGR.dylib”  
“libGR3.dylib”  
“libGRM.dylib”  
“libqt5gr.dylib”  
“libqt6gr.dylib”  
“pgfplugin.so”  
“qt5plugin.so”  
“qt6plugin.so”  
“qtplugin.so”  
“quartzplugin.so”  
“svgplugin.so”  
“videoplugin.so”  
“wmfplugin.so”  
“wxplugin.so”  
“x11plugin.so”  
“zmqplugin.so”

So, it appears that I’ve got libGR.dylib, but the message says it’s missing libGR.so.dylib.

I’ve got no idea what could have happened.

---

<div class="post-metadata">

**Author:** ![bwanab](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bwanab/32/35903_2.png) [@bwanab](https://discourse.julialang.org/u/bwanab)\
**Post date:** [July 16, 2022, 3:18pm UTC](https://discourse.julialang.org/t/simple-plotting-i-am-getting-could-not-load-library-libgr-so/48611/9 "2022-07-16T15:18:20Z")

</div>

I solved this by cd into join path(ENV[“GRDIR”], “lib”) and copying libGR.dylib to libGR.so.dylib.

I can work again, but I still don’t have a clue why this happened.

---

<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:** [July 16, 2022, 6:27pm UTC](https://discourse.julialang.org/t/simple-plotting-i-am-getting-could-not-load-library-libgr-so/48611/10 "2022-07-16T18:27:45Z")

</div>

That is weird. Why would there be a “.so.dylib”? Why are there .so and .dylib on the same system.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [July 16, 2022, 7:32pm UTC](https://discourse.julialang.org/t/simple-plotting-i-am-getting-could-not-load-library-libgr-so/48611/11 "2022-07-16T19:32:48Z")

</div>

If it helps, I think I was hit in Win11 Julia 1.7.3 by a similar problem when trying to plot with `gr()` backend, getting: `ERROR: could not load library "libGR.dll`.

The problem was that the project environment had old versions of Plots.jl and GR.jl installed, and I couldn’t update them as compatibility with some other package was blocking it.

By forcing an update, we can see which package was blocking the update of Plots.jl:  
`] add Plots@1.31.2`

I removed the problematic package and did `update` and `rebuild` in the package manager. Then I restarted and voilà, Plots.jl was back in business.
