Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot load backend 'Qt5Agg' which requires the 'qt5' interactive framework, as 'headless' is currently running

I am trying to use Qt as matplotlib backend. i have checked it both on kaggle and google colab, but problem is same.

When i write

%matplotlib qt5

i got following error

ImportError: Cannot load backend 'Qt5Agg' which requires the 'qt5' interactive framework, as 'headless' is currently running

When i print default backend, its already Qt5Agg

import matplotlib
print(matplotlib.get_backend())
like image 576
Talha Anwar Avatar asked May 14 '19 11:05

Talha Anwar


1 Answers

This is happening because Google Colab and Jupyter run on virtual environments which do not support GUI outputs as you cannot open new windows through a browser.

Running it locally on a code editor(Spyder, or even IDLE) ensures that it can open a new window for the GUI to initialize.

For coding the GUI it is best to do it locally on a full-fledged code editor.

like image 187
am-3 Avatar answered Dec 07 '22 17:12

am-3