You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Warning: Cannot change to a different GUI toolkit: notebook. Using qt instead. #11365
When I try to use the jupyter notebook %matplotlib notebook magic command on Linux (as the first command executed in the notebook), I get this warning:
Warning: Cannot change to a different GUI toolkit: notebook. Using qt instead.
Plots then appear a separate qt window, outside the browser. The %matplotlib inline command does work.
This occurs in freshly-opened jupyter notebooks, with a fresh kernel.
Is there a reason why we can't change backends on the fly? It is super useful at times.
You can end up with conflicting event loops, changing the backend changes some module level state in pyplot, different GUIs need different input hooks to be interactive at the prompt, and there is state in Gcf. If any of it gets out of sync with the rest things get very broken very fast in ways that are very hard to reproduce / communicate via github issue. Even though we think it works now (including checks that you won't go to a known-broken state), it is better not to....
I guess I'm ok with working in a jupyter notebook. then maybe outputting to QT for a bit, closing all my figures, and outputting again to the notebook.
I discourage using the native GUI backends inside of notebooks / jlab. That relies on the fact that your server is running locally so the windows pop-up in the right place. The biggest selling point (for me) of Jupyter is that you can run the kernels somewhere else (which gets you 0 install, access to big compute, and locality with data storage (I am very much wearing my "I work at a user facility" hat)). Better to not get bad habits that won't transfer well.....
@tacaswell I guess I often crash my browser when viewing and interacting with images. Native backends are often unavoidable :/. 4K screens, large images, are challenging to deal with :/
I had this warning come up recently after adding the line c.InteractiveShellApp.gui = 'qt5'
in my ipython_config.py file. Commenting out this line removed the warning.
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
Activity
jklymak commentedon Jun 2, 2018
Do you have something set in your matplotlibrc?
tacaswell commentedon Jun 2, 2018
How are you starting the notebook server?
parejkoj commentedon Jun 7, 2018
I don't have a personal matplotlibrc. Is there a system one I should check for?
jupyter notebookfrom a terminal.hmaarrfk commentedon Oct 31, 2018
Is there a reason why we can't change backends on the fly? It is super useful at times.
jklymak commentedon Oct 31, 2018
Matplotlib.use has a force kwarg that allows you to change on the fly. For 3.0.2 this will default to True, allowing switching on the fly
Still not sure why this is happening for this user.
hmaarrfk commentedon Oct 31, 2018
@jklymak Wow thanks for letting me know about that! Pretty awesome!
jklymak commentedon Oct 31, 2018
#12608 is the PR...
tacaswell commentedon Oct 31, 2018
You can end up with conflicting event loops, changing the backend changes some module level state in
pyplot, different GUIs need different input hooks to be interactive at the prompt, and there is state inGcf. If any of it gets out of sync with the rest things get very broken very fast in ways that are very hard to reproduce / communicate via github issue. Even though we think it works now (including checks that you won't go to a known-broken state), it is better not to....hmaarrfk commentedon Oct 31, 2018
Hmm interesting. Yeah, even programming is tough.
I guess I'm ok with working in a jupyter notebook. then maybe outputting to QT for a bit, closing all my figures, and outputting again to the notebook.
jklymak commentedon Oct 31, 2018
#12608 should not allow two GUI backends to be used if one of them has already been started. So its not totally "on-the-fly"
tacaswell commentedon Oct 31, 2018
I discourage using the native GUI backends inside of notebooks / jlab. That relies on the fact that your server is running locally so the windows pop-up in the right place. The biggest selling point (for me) of Jupyter is that you can run the kernels somewhere else (which gets you 0 install, access to big compute, and locality with data storage (I am very much wearing my "I work at a user facility" hat)). Better to not get bad habits that won't transfer well.....
hmaarrfk commentedon Oct 31, 2018
@tacaswell I guess I often crash my browser when viewing and interacting with images. Native backends are often unavoidable :/. 4K screens, large images, are challenging to deal with :/
astromancer commentedon May 20, 2020
I had this warning come up recently after adding the line
c.InteractiveShellApp.gui = 'qt5'in my
ipython_config.pyfile. Commenting out this line removed the warning.pspiagicw commentedon Nov 8, 2021
Is this issue resolved in the new versions ?
tacaswell commentedon Dec 24, 2021
This should be lazier now and there is an open PR (#22005) to make it even lazier.
github-actions commentedon May 8, 2023
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!