2

I am unable to change backend of matplotlib to tkEgg in Google Colab. Google Colab runtime throws the following error on changing matplitlib backend:

Error

ImportError: Cannot load backend 'TkAgg' which requires the 'tk' interactive framework, as 'headless' is currently running*

My Code :
import matplotlib
import tkinter
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
Already Tried

I have already tried solution provided Here but it is not working for me.

Jawad Tariq
  • 335
  • 1
  • 3
  • 14

1 Answers1

1

I understand, as the error shows, that you are running in a headless environment (i.e. $DISPLAY is not set). Is there any particular reason you'd want to use TkAgg over Agg as your backend?

See a related answer here, and the linked duplicate.

Carlos Segarra
  • 785
  • 7
  • 9