So I was running code earlier and got the following warning:
Warning (from warnings module):
File "<string>", line 558
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 rcParam
`figure.max_open_warning`).
Warning (from warnings module):
File "<string>", line 665
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 rcParam
`figure.max_open_warning`).
Not going to lie, I was being very careless and was still running it anyway, ignoring the warning. Now whenever I try to run the script, my python shell doesn't run the script.
So I am trying to remove the graphs from the memory to allow me to run script again.
I have tried the following and it still won't let me run the code:
plt.clf()
plt.cla()
f = plt.figure()
f.clear()
plt.close(f)
plt.close('all')
matplotlib.pyplot.figure().clear()
matplotlib.pyplot.close()
How can I fix this issue?