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

Dear Community,

I’m doing an ML project involving clustering, and I would like to use KMeansVisualizer from yellowbricks, the library is easy to use and does the heavy lifting for you - Basically I’m getting this error;

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

This is my code:

df_scale = scale_data(get_data())

model = KMeans()
visualizer = KElbowVisualizer(model,k=(2,30), timings = True)
visualizer.fit(df_scale)
st.write(visualizer)

I understand that the object return from the visualizer object is different, so how can you render this object?

to make sure did you try python - "UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure." when plotting figure with pyplot on Pycharm - Stack Overflow already?