import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt