Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot change to a different GUI toolkit: notebook - Warning in Jupyter

I want to use the interactive plots in jupyter, but when switching the backend to notebook, I get the warning: Warning: Cannot change to a different GUI toolkit: notebook. Using qt5 instead.

This happens on Windows 10, Anaconda 1.8.7, jupyter 5.5.0, python 3.6.5 and matplotlib 2.2.2.

Minimal working example:

import matplotlib.pyplot as plt
%matplotlib notebook

Output:

Warning: Cannot change to a different GUI toolkit: notebook. Using qt5 instead.

I found some question here where the problem is the other way around, but could not find anyone having this problem yet. In some cases, importing ipympl is mentioned as a solution, but this does not change anything in my case.

Any hints?

like image 922
Christian Weber Avatar asked Oct 08 '18 13:10

Christian Weber


2 Answers

You must put %matplotlib widget in the very beginning of the Jupyterlab

like image 162
Ulysses Avatar answered Nov 10 '22 13:11

Ulysses


As ImportanceOfBeingErnest pointed out in the comments, my problem was related to the backend already being set when jupyter starts. However, as mentioned in this post, the backend needs to be set in the ipython_config.py, not the jupyter_notebook_config.py.

After restarting the notebook server, I can switch between backends as described here.

like image 26
Christian Weber Avatar answered Nov 10 '22 11:11

Christian Weber