`Plots` fails to draw in julia-1.0

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

(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.

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”.

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

pkg> build GR

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

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

Edit: Or add a comment to 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 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.

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:

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

Does

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?

Oh, whoops, I meant

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

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

1 Like

Here is the output at the terminal:

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?

Forgot to say - Thank you!