import matplotlib
# first check which backend
maplotlib.get_backend()
# change
matplotlib.rcParams['backend'] = 'GTK3Agg'- Create a config file at
~/.config/matplotlib/matplotlibrc - In this file set the value of backend as:
backend: GTK3AggJust use agg as the backend.