"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

Solution 1:

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