+3 votes
in Programming Languages by (60.0k points)

I am trying to display the plot using plt.show(), but this function gives the following warning and does not display the plot.

UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure

How can I fix this issue so that the plot is displayed?

1 Answer

+3 votes
by (72.7k points)
selected by
 
Best answer

You do not seem to have graphical user interfaces (GUI) software installed on your environment. You need software, such as Qt, to create graphical user interfaces (GUI). 

Install pyqt5 by running the following command on the terminal. If the installation is successful, the warning should go away, and the plot should be displayed.

pip install pyqt5


...