# \`Plots\` fails to draw in julia-1.0

**URL:** <https://discourse.julialang.org/t/plots-fails-to-draw-in-julia-1-0/16055>\
**Category:** General Usage\
**Tags:** question\
**Created:** [October 9, 2018, 3:19am UTC](https://discourse.julialang.org/t/plots-fails-to-draw-in-julia-1-0/16055 "2018-10-09T03:19:51Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)\
**Post date:** [October 9, 2018, 3:19am UTC](https://discourse.julialang.org/t/plots-fails-to-draw-in-julia-1-0/16055/1 "2018-10-09T03:19:51Z")

</div>

Trying `Plots` the very first time in julia-1.0 on my Ubuntu machine and seeing the following error:

```julia
(v1.0) pkg> st
    Status `~/.julia/environments/v1.0/Project.toml`
  [c52e3926] Atom v0.7.8
  [28b8d3ca] GR v0.34.1
  [e5e0dc1b] Juno v0.5.3
  [91a5bcdd] Plots v0.20.5
  [d330b81b] PyPlot v2.6.3
  [ee283ea6] Rebugger v0.1.4
  [295af30f] Revise v0.7.12

julia> plot(1:3)
ERROR: error compiling _plot!: error compiling _display: could not load library "libGR.so"
libGR.so: cannot open shared object file: No such file or directory
Stacktrace:
 [1] #plot#132(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::UnitRange{Int64}) at /home/chobbes/.julia/packages/Plots/7o1Vu/src/plot.jl:57
 [2] plot(::UnitRange{Int64}) at /home/chobbes/.julia/packages/Plots/7o1Vu/src/plot.jl:51
 [3] top-level scope at none:0

```

Is this a bug? Or I’m supposed to do something else before I can call GR. Not seeing this kind of error on my Windows machine.

---

<div class="post-metadata">

**Author:** ![Ajaychat3](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@Ajaychat3](https://discourse.julialang.org/u/Ajaychat3)\
**Post date:** [October 9, 2018, 4:51am UTC](https://discourse.julialang.org/t/plots-fails-to-draw-in-julia-1-0/16055/2 "2018-10-09T04:51:20Z")

</div>

You need to import the Plots package using “import Plots” or “using Plots”

---

<div class="post-metadata">

**Author:** ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)\
**Post date:** [October 9, 2018, 6:57am UTC](https://discourse.julialang.org/t/plots-fails-to-draw-in-julia-1-0/16055/3 "2018-10-09T06:57:27Z")

</div>

> [@Ajaychat3](#):
>
> You need to import the Plots package using “import Plots” or “using Plots”

Of course, I have done this. The error was thrown after “using Plots”.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [October 9, 2018, 6:59am UTC](https://discourse.julialang.org/t/plots-fails-to-draw-in-julia-1-0/16055/4 "2018-10-09T06:59:18Z")

</div>

It looks like `GR` might not have build properly. Perhaps you can try to

```julia
pkg> build GR

```

---

<div class="post-metadata">

**Author:** ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)\
**Post date:** [October 9, 2018, 7:01am UTC](https://discourse.julialang.org/t/plots-fails-to-draw-in-julia-1-0/16055/5 "2018-10-09T07:01:20Z")

</div>

> [@fredrikekre](#):
>
> It looks like `GR` might not have build properly. Perhaps you can try to
> 
> ```julia
> pkg> build GR
> 
> ```

Forgot to mention - this has been done too. It’s really unfathomable.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [October 9, 2018, 7:08am UTC](https://discourse.julialang.org/t/plots-fails-to-draw-in-julia-1-0/16055/6 "2018-10-09T07:08:17Z")

</div>

I suggest you open an issue at the GR repo, [https://github.com/jheinen/GR.jl](https://github.com/jheinen/GR.jl).

Edit: Or add a comment to [https://github.com/jheinen/GR.jl/issues/158](https://github.com/jheinen/GR.jl/issues/158) since that seems to be the same issue.

---

<div class="post-metadata">

**Author:** ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)\
**Post date:** [October 9, 2018, 7:15am UTC](https://discourse.julialang.org/t/plots-fails-to-draw-in-julia-1-0/16055/7 "2018-10-09T07:15:39Z")

</div>

> [@fredrikekre](#):
>
> I suggest you open an issue at the GR repo, [GitHub - jheinen/GR.jl: Plotting for Julia based on GR, a framework for visualisation applications](https://github.com/jheinen/GR.jl).
> 
> Edit: Or add a comment to [test fail GR / error compiling tick: could not load library "libGR.so" · Issue #158 · jheinen/GR.jl · GitHub](https://github.com/jheinen/GR.jl/issues/158) since that seems to be the same issue.

Thanks. But I’m not 100% sure that this is an issue from GR. In fact, if I try to plot something right after I start julia-v1.0, here is what I see:

```julia
Julia has exited. Press Enter to start a new session.
Starting Julia...
               _
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.0.1 (2018-09-29)
 _/ |\ __'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

julia> using Plots

julia> plot(1:3)
┌ Warning: You have set `PLOTS_DEFAULT_BACKEND=PyPlot` but `PyPlot` is not loaded.
└ @ Plots ~/.julia/packages/Plots/7o1Vu/src/backends.jl:149
ERROR: error compiling _plot!: error compiling _display: could not load library "libGR.so"
libGR.so: cannot open shared object file: No such file or directory
Stacktrace:
 [1] #plot#132(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::UnitRange{Int64}) at /home/chobbes/.julia/packages/Plots/7o1Vu/src/plot.jl:57
 [2] plot(::UnitRange{Int64}) at /home/chobbes/.julia/packages/Plots/7o1Vu/src/plot.jl:51
 [3] top-level scope at none:0

```

As you can see, I set `PyPlot` as the default backend in startup.jl. Of course, I have `PyPlot` installed and built. Don’t see what ` `PyPlot` is not loaded` means and why this is the case.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [October 9, 2018, 1:39pm UTC](https://discourse.julialang.org/t/plots-fails-to-draw-in-julia-1-0/16055/8 "2018-10-09T13:39:00Z")

</div>

Try to locate libGR.so (using `find`). If it is not found, then it is definitely time to file an issue for GR.

---

<div class="post-metadata">

**Author:** ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)\
**Post date:** [October 9, 2018, 1:55pm UTC](https://discourse.julialang.org/t/plots-fails-to-draw-in-julia-1-0/16055/9 "2018-10-09T13:55:40Z")

</div>

> [@PetrKryslUCSD](#):
>
> Try to locate libGR.so (using `find` ). If it is not found, then it is definitely time to file an issue for GR.

Thanks! `Find` didn’t return anything close to `libGR`. So I have added a comment in ticket 158.

But still wonder the meaning of `PyPlot` not loaded:

```julia
┌ Warning: You have set `PLOTS_DEFAULT_BACKEND=PyPlot` but `PyPlot` is not loaded.
└ @ Plots ~/.julia/packages/Plots/7o1Vu/src/backends.jl:149

```

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [October 9, 2018, 1:56pm UTC](https://discourse.julialang.org/t/plots-fails-to-draw-in-julia-1-0/16055/10 "2018-10-09T13:56:56Z")

</div>

Does

```julia
using Plots
plotly()
plot(rand(3))

```

work?

---

<div class="post-metadata">

**Author:** ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)\
**Post date:** [October 9, 2018, 2:01pm UTC](https://discourse.julialang.org/t/plots-fails-to-draw-in-julia-1-0/16055/11 "2018-10-09T14:01:34Z")

</div>

> [@pfitzseb](#):
>
> Does
> 
> ```julia
> using Plots
> plotly()
> plot(rand(3))
> 
> ```
> 
> work?

Most weirdly, these lines tried to open a new tab in my firefox brower and the address reads `file:///tmp/juliaVrrjfI.html`. What does this mean?

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [October 9, 2018, 2:10pm UTC](https://discourse.julialang.org/t/plots-fails-to-draw-in-julia-1-0/16055/12 "2018-10-09T14:10:04Z")

</div>

Oh, whoops, I meant

```julia
using Plots
pyplot()
plot(rand(3))

```

Opening a new tab in the browser is the right behaviour for the Plotly backend.

---

<div class="post-metadata">

**Author:** ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)\
**Post date:** [October 9, 2018, 2:19pm UTC](https://discourse.julialang.org/t/plots-fails-to-draw-in-julia-1-0/16055/13 "2018-10-09T14:19:06Z")

</div>

> [@pfitzseb](#):
>
> Oh, whoops, I meant
> 
> ```julia
> using Plots
> pyplot()
> plot(rand(3))
> 
> ```
> 
> Opening a new tab in the browser is the right behaviour for the Plotly backend.

Here is the output at the terminal:

```julia
julia> pyplot()
[Info: Precompiling PyPlot [d330b81b-6aea-500a-939a-2ce795aea3ee]
[ Info: Installing matplotlib via the Conda matplotlib package...
[ Info: Running `conda install -y matplotlib` in root environment
Solving environment: done

## Package Plan ##

  environment location: /home/chobbes/.julia/packages/Conda/hsaaN/deps/usr

  added / updated specs:
    - matplotlib

The following packages will be downloaded:

    package | build
    ---------------------------|-----------------
    icu-58.2 | h9c2bf20_1 22.5 MB
    fontconfig-2.13.0 | h9420a91_0 291 KB
    gstreamer-1.14.0 | hb453b48_1 3.8 MB
    dbus-1.13.2 | h714fa37_1 554 KB
    pytz-2018.5 | py37_0 231 KB
    qt-5.9.6 | h8703b6f_2 87.1 MB
    glib-2.56.2 | hd408876_0 5.0 MB
    python-dateutil-2.7.3 | py37_0 260 KB
    libuuid-1.0.3 | h1bed415_2 16 KB
    jpeg-9b | h024ee3a_2 248 KB
    gst-plugins-base-1.14.0 | hbbd80ab_1 6.3 MB
    kiwisolver-1.0.1 | py37hf484d3e_0 83 KB
    matplotlib-3.0.0 | py37h5429711_0 6.8 MB
    expat-2.2.6 | he6710b0_0 187 KB
    libxml2-2.9.8 | h26e45fe_1 2.0 MB
    libxcb-1.13 | h1bed415_1 502 KB
    tornado-5.1.1 | py37h7b6447c_0 662 KB
    cycler-0.10.0 | py37_0 13 KB
    pyqt-5.9.2 | py37h05f1152_2 5.6 MB
    pyparsing-2.2.1 | py37_0 96 KB
    sip-4.19.8 | py37hf484d3e_0 290 KB
    freetype-2.9.1 | h8a8886c_1 822 KB
    pcre-8.42 | h439df22_0 251 KB
    libpng-1.6.34 | hb9fc6fc_0 334 KB
    ------------------------------------------------------------
                                           Total: 143.7 MB

The following NEW packages will be INSTALLED:

    cycler: 0.10.0-py37_0
    dbus: 1.13.2-h714fa37_1
    expat: 2.2.6-he6710b0_0
    fontconfig: 2.13.0-h9420a91_0
    freetype: 2.9.1-h8a8886c_1
    glib: 2.56.2-hd408876_0
    gst-plugins-base: 1.14.0-hbbd80ab_1
    gstreamer: 1.14.0-hb453b48_1
    icu: 58.2-h9c2bf20_1
    jpeg: 9b-h024ee3a_2
    kiwisolver: 1.0.1-py37hf484d3e_0
    libpng: 1.6.34-hb9fc6fc_0
    libuuid: 1.0.3-h1bed415_2
    libxcb: 1.13-h1bed415_1
    libxml2: 2.9.8-h26e45fe_1
    matplotlib: 3.0.0-py37h5429711_0
    pcre: 8.42-h439df22_0
    pyparsing: 2.2.1-py37_0
    pyqt: 5.9.2-py37h05f1152_2
    python-dateutil: 2.7.3-py37_0
    pytz: 2018.5-py37_0
    qt: 5.9.6-h8703b6f_2
    sip: 4.19.8-py37hf484d3e_0
    tornado: 5.1.1-py37h7b6447c_0

Downloading and Extracting Packages
icu-58.2 | 22.5 MB | ########################################################################################################## | 100%
fontconfig-2.13.0 | 291 KB | ########################################################################################################## | 100%
gstreamer-1.14.0 | 3.8 MB | ########################################################################################################## | 100%
dbus-1.13.2 | 554 KB | ########################################################################################################## | 100%
pytz-2018.5 | 231 KB | ########################################################################################################## | 100%
qt-5.9.6 | 87.1 MB | ########################################################################################################## | 100%
glib-2.56.2 | 5.0 MB | ########################################################################################################## | 100%
python-dateutil-2.7. | 260 KB | ########################################################################################################## | 100%
libuuid-1.0.3 | 16 KB | ########################################################################################################## | 100%
jpeg-9b | 248 KB | ########################################################################################################## | 100%
gst-plugins-base-1.1 | 6.3 MB | ########################################################################################################## | 100%
kiwisolver-1.0.1 | 83 KB | ########################################################################################################## | 100%
matplotlib-3.0.0 | 6.8 MB | ########################################################################################################## | 100%
expat-2.2.6 | 187 KB | ########################################################################################################## | 100%
libxml2-2.9.8 | 2.0 MB | ########################################################################################################## | 100%
libxcb-1.13 | 502 KB | ########################################################################################################## | 100%
tornado-5.1.1 | 662 KB | ########################################################################################################## | 100%
cycler-0.10.0 | 13 KB | ########################################################################################################## | 100%
pyqt-5.9.2 | 5.6 MB | ########################################################################################################## | 100%
pyparsing-2.2.1 | 96 KB | ########################################################################################################## | 100%
sip-4.19.8 | 290 KB | ########################################################################################################## | 100%
freetype-2.9.1 | 822 KB | ########################################################################################################## | 100%
pcre-8.42 | 251 KB | ########################################################################################################## | 100%
libpng-1.6.34 | 334 KB | ########################################################################################################## | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
ERROR: ArgumentError: Package PyCall not found in current path:
- Run `import Pkg; Pkg.add("PyCall")` to install the PyCall package.

Stacktrace:
 [1] require(::Module, ::Symbol) at ./loading.jl:820
 [2] top-level scope at /home/chobbes/.julia/packages/Plots/7o1Vu/src/backends.jl:389
 [3] eval at ./boot.jl:319 [inlined]
 [4] _initialize_backend(::Plots.PyPlotBackend) at /home/chobbes/.julia/packages/Plots/7o1Vu/src/backends.jl:388
 [5] backend(::Plots.PyPlotBackend) at /home/chobbes/.julia/packages/Plots/7o1Vu/src/backends.jl:196
 [6] backend(::Symbol) at /home/chobbes/.julia/packages/Plots/7o1Vu/src/backends.jl:209
 [7] pyplot() at /home/chobbes/.julia/packages/Plots/7o1Vu/src/backends.jl:29
 [8] top-level scope at none:0

```

I’m surprised that I’m asked to install `PyCall` (in fact, `LaTeXStrings` too) manually. I thought it should have been done automatically in v1.0.

Edit: Now it works after manually installing `PyCall` and `LaTexStrings`. Ain’t they supposed to be installed automatically when I add `PyPlot`? I’m confused. I guess this is a bug in `PyPlot`’s `Manifest.toml` or `Project.toml`?

---

<div class="post-metadata">

**Author:** ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)\
**Post date:** [October 9, 2018, 2:31pm UTC](https://discourse.julialang.org/t/plots-fails-to-draw-in-julia-1-0/16055/14 "2018-10-09T14:31:06Z")

</div>

> [@pfitzseb](#):
>
> Oh, whoops, I meant

Forgot to say - Thank you!
