non-GUI backend, so cannot show the figure

I’ve the below code that worked with jupyter lab, but once tried it with Julia REPL or PyCharm with Julia plugin I got the below error:

┌ Warning: No working GUI backend found for matplotlib
└ @ PyPlot C:\Users\hasan.DESKTOP-HU2FQ29\.julia\packages\PyPlot\4wzW1\src\init.jl:165
sys:1: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.

my code is:

using Pkg
using Plots, Measures

data = [rand(100), rand(100)];

h = histogram(data, layout = 2,
              title = ["Dataset A" "Dataset B"], legend = false,
              ylabel = "ylabel", margin = 5mm)

I’m using Pythin3 x64 with Julia Version 1.2.0 (2019-08-20) at Windows 10

You need to install a GUI toolkit for so that Matplotlib can display graphics (outside of Jupyter, where the browser handles display). For example, if you install the pyqt package then PyPlot should automatically use the qt5agg backend.

(From your other post, you are using a custom Python installation — things would probably go more smoothly if you allowed Julia to install its own Python via the Conda package, in which case it could install Python packages for you.)


Thanks, it worked after installing it as explained here:

$ pip3 install PyQt5==5.9.2