Failed to create png image on non graphic node

Hello,
Plot image (.png) creation failed on Linux machine which is a non graphic node, is it expected? what are the Linux system requirements? sample code is as follows

fname='test_file'
import matplotlib.pyplot as plt
fig, ax = plt.subplots( nrows=1, ncols=1 )
ax.plot([10,11,12], [101,19,12])	
fname_img=fname+'.png'
fig.savefig(fname_img)
plt.close(fig)

Thanks,
Srinivas

No that is not expected. Can you be more clear by what you mean “creation failed”?

I mean, “test_file.png” file is not created on disk. But when I executed the same script on graphic node, it created the “test_file.png” file on disk. Issue noticed when executed on NON graphic node.

Ok but there must be an error emitted.

Perhaps just put

import matplotlib
matplotlib.use('agg')

at the top of your script.

1 Like