matplotlib.use('Qt5Agg') doesn't work in Colab ?!

Hello everyone,

Does anyone know why matplotlib.use(‘Qt5Agg’) doesn’t work in Colab?
It gives me this error: ImportError: Cannot load backend ‘Qt5Agg’ which requires the ‘qt’ interactive framework, as ‘headless’ is currently running

I have imported the package: pip install PyQt5-Qt5
but it doesn’t work, is there any compatibility problem in collaboration with dynamic graphics?

Thanks in advance!

Xavier,

Qt doesn’t work in Colab. You will need to use the inline or widget backend (ipywidgets).

Richard

2 Likes

ok thanks Richard !

This is what has worked for me:

pip install ipywidgets

from google.colab import output
output.enable_custom_widget_manager()
%matplotlib widget

regards!

Xavier,

2 Likes