"Matplotlib is currently using agg, which is non-GUI backend, so cannot show the figure." error when trying to plot with Matplotlib on Ubuntu 20.04

I'm using Ubuntu 20.04 LTS. I've recently installed Matplotlib for Python 3.9 and when I try to plot a graph it gives me the error:

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

Do I have to install something else for it to work?

1 Answer

Yes, you have to. The accepted answer to this similar Stack Overflow question suggests that the problem is that tkinter is not installed. You can install it using:

sudo apt install python3-tk
0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like