I am running a python code that produces some figures with Matplotlib and Pandas. After a few runs of the code, I am getting to following error:
RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (
matplotlib.pyplot.figure
) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParamfigure.max_open_warning
)
I think this is because I forgot to close the figures after each run of the code. I have tried
plt.close('all')
but it does not close the figures from previous sessions. Restarting the terminal (conda) did not help either.