Skip to content

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

Closed as not planned

Description

@parejkoj

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.

Activity

  1. jklymak commented on Jun 2, 2018

    @jklymak
    Member

    Do you have something set in your matplotlibrc?

  2. tacaswell commented on Jun 2, 2018

    @tacaswell
    Member

    How are you starting the notebook server?

  3. parejkoj commented on Jun 7, 2018

    @parejkoj
    Author

    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.

  4. hmaarrfk commented on Oct 31, 2018

    @hmaarrfk
    Contributor

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

  5. jklymak commented on Oct 31, 2018

    @jklymak
    Member

    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.

  6. hmaarrfk commented on Oct 31, 2018

    @hmaarrfk
    Contributor

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

  7. jklymak commented on Oct 31, 2018

    @jklymak
    Member

    #12608 is the PR...

  8. tacaswell commented on Oct 31, 2018

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

  9. hmaarrfk commented on Oct 31, 2018

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

  10. jklymak commented on Oct 31, 2018

    @jklymak
    Member

    #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"

  11. tacaswell commented on Oct 31, 2018

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

  12. hmaarrfk commented on Oct 31, 2018

    @hmaarrfk
    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 :/

  13. astromancer commented on May 20, 2020

    @astromancer

    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.

  14. pspiagicw commented on Nov 8, 2021

    @pspiagicw

    Is this issue resolved in the new versions ?

  15. tacaswell commented on Dec 24, 2021

    @tacaswell
    Member

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

  16. github-actions commented on May 8, 2023

    @github-actions

    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!

  17. added
    status: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.
    on Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions