When drawing on the server side using matplotlib (savefig () etc.)
Traceback
...
RuntimeError: Invalid DISPLAY variable
You may get angry. This seems to be due to the fact that the display destination DISPLAY is not set. I often see Solution 1, but it's a note when it still doesn't work.
import matplotlib
matplotlib('Agg')
import matplotlib.pyplot as pet
import matplotlib.pyplot as plt
plt.switch_backend('agg')
Recommended Posts