The fix is to add: import matplotlib matplotlib.use('TkAgg') at the beginning of the driver files or on the first import MOSFIRE