Skip to content

Warning: Cannot change to a different GUI toolkit: notebook. Using qt instead. #11365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
parejkoj opened this issue Jun 1, 2018 · 16 comments
Closed
Labels
status: closed as inactive Issues closed by the "Stale" Github Action. Please comment on any you think should still be open. status: inactive Marked by the “Stale” Github Action third-party integration: jupyter

Comments

@parejkoj
Copy link

parejkoj commented Jun 1, 2018

Bug report

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.

  • Operating system: Ubuntu 16.04/18.04
  • Matplotlib version: 2.1.1
  • Python version: 3.6.3
  • jupyter (1.0.0)
  • jupyter-client (5.2.3)
  • jupyter-console (5.2.0)
  • jupyter-core (4.4.0)
  • notebook (5.5.0)

LSST miniconda:
https://github.com/lsst/lsstsw/blob/master/etc/conda3_packages-linux-64.txt

I've since upgraded matplotlib and jupyter to attempt to remedy this, but upgrading didn't change the error.

@jklymak
Copy link
Member

jklymak commented Jun 2, 2018

Do you have something set in your matplotlibrc?

@tacaswell
Copy link
Member

How are you starting the notebook server?

@parejkoj
Copy link
Author

parejkoj commented Jun 7, 2018

Do you have something set in your matplotlibrc?

I don't have a personal matplotlibrc. Is there a system one I should check for?

How are you starting the notebook server?

jupyter notebook from a terminal.

@hmaarrfk
Copy link
Contributor

Is there a reason why we can't change backends on the fly? It is super useful at times.

@jklymak
Copy link
Member

jklymak commented 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
Copy link
Contributor

@jklymak Wow thanks for letting me know about that! Pretty awesome!

@jklymak
Copy link
Member

jklymak commented Oct 31, 2018

#12608 is the PR...

@tacaswell
Copy link
Member

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....

@hmaarrfk
Copy link
Contributor

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
Copy link
Member

jklymak commented 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
Copy link
Member

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
Copy link
Contributor

@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
Copy link
Contributor

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.

@pspiagicw
Copy link

Is this issue resolved in the new versions ?

@tacaswell
Copy link
Member

This should be lazier now and there is an open PR (#22005) to make it even lazier.

@github-actions
Copy link

github-actions bot commented 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!

@github-actions github-actions bot added the status: inactive Marked by the “Stale” Github Action label May 8, 2023
@github-actions github-actions bot added the status: closed as inactive Issues closed by the "Stale" Github Action. Please comment on any you think should still be open. label Jun 7, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: closed as inactive Issues closed by the "Stale" Github Action. Please comment on any you think should still be open. status: inactive Marked by the “Stale” Github Action third-party integration: jupyter
Projects
None yet
Development

No branches or pull requests

7 participants