RuntimeError: Invalid DISPLAY variable [How to Solve]

Error Messages:

RuntimeError: Invalid DISPLAY variable

Solution:

add the following codes

plt.switch_backend('agg')

after this line

import matplotlib.pyplot as plt

Done!

Read More: