I got a problem with backend in matplotlib.
I used ipython for launching the codes and
the backend of matplotlib is GTKAgg. I have a code.py with a for loop for processing data, and in each
iteration I read and plot and save the figures. Because there
are so many figures, I set the non-interative mode and not using “show()” in the code. Then the memory is used more and more as the
iteration number increases, and the most memory is
due to write_png function. I guess that the figures
(though not shown on the screen) from each iteration take the memory, and try to close the figures produced at each
what I did:
modify the backend to Agg in the code
add “close(‘all’)” before each iteration finish.
This works for removing the memory problem. But a new issue
arrive. After the run is finished, the ipython command window
has no response to any keyboard input for a few seconds, then a warning message appear:
“Warning: Timeout for mainloop thread exceeded switching to
nonthreaded mode (until mainloop wakes up again)”,
and when I tried to quit ipython afterwards, it is stuck there
and the ipython is crashed.
But if I tried using “python code.py” , then it works well : no warnings.
Does it mean that we can not use ipython and a backend non-GUI at the same time ?
Any one would like to explain a bit ? Thanks in advance !!