FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

No keyboard focus in figures on macOS with Anaconda · Issue #9839 · matplotlib/matplotlib · GitHub

Repository navigation

No keyboard focus in figures on macOS with Anaconda #9839

Closed

Description

Using Python installed via Anaconda on macOS, figures do not receive keyboard focus. All key presses go to the terminal instead.

Minimal example:

import matplotlib.pyplot as plt
plt.plot(1)
plt.show()
# then click on the "Save" icon
# it is impossible to change the file name in the dialog window

The same thing happens when listening to key press events - they are simply not detected at all.

Using Python installed via Homebrew doesn't have this problem. There are some reports regarding this behavior (#665, #2120, #3367, #4372), but I still run into this issue. I'm using the latest Anaconda packages and tried the latest Matplotlib release and latest development version.

Activity

  1. cbrnr commented on Nov 23, 2017

    ContributorAuthor

    Update: This only happens when using the (default) osx backend.

  2. dstansby commented on Nov 23, 2017

    Member

    Are you using the framework build of python? (ie. are you starting python using pythonw)

  3. cbrnr commented on Nov 23, 2017

    ContributorAuthor

    No. It works with pythonw, but how can I start IPython using this framework build?

  4. jklymak commented on Nov 23, 2017

    Member

    Here is a magic incantation to get ipython to play w pythonw #8982 (comment)

  5. cbrnr commented on Nov 24, 2017

    ContributorAuthor

    Nice, thanks @jklymak this works! I wish Anaconda made pythonw the default for everything to avoid these kinds of tricks. Has anyone ever asked them why they don't want to play nice with macOS frameworks?

  6. jklymak commented on Nov 24, 2017

    Member

    Ha ha. I think there are a few threads about it.... I don't understand the issue, but, I don't use ipython except via jupyter notebooks, so...

  7. efiring commented on Nov 24, 2017

    Member
  8. cbrnr commented on Nov 24, 2017

    ContributorAuthor

    OMG what's the tl;dr? I assume not much has happened. This is the one reason why I can't recommend Anaconda on macOS without any reservations.

  9. jklymak commented on Nov 24, 2017

    Member

    There is an open issue: ContinuumIO/anaconda-issues#199

  10. jklymak commented on Nov 24, 2017

    Member

    if you want more bedtime reading ;-)

  11. efiring commented on Nov 24, 2017

    Member
  12. cbrnr commented on Nov 24, 2017

    ContributorAuthor

    You're right, but the problem with this is that osx is the default backend. If it wasn't this wouldn't be such a big issue. Anaconda could probably change the default to qt5 because PyQt5 gets installed anyway.

  13. jklymak commented on Nov 24, 2017

    Member

    #9795 will make it easier to configure the "default" on a user-by-user basis...

  14. tacaswell commented on Nov 25, 2017

    Member

    I thought qt5 was the default on osx with conda....Did that change recently?

  15. efiring commented on Nov 25, 2017

    Member

    [I just checked by installing from defaults (version 2.0.2) and from conda-forge (version 2.1.0), and in both cases the backend default is qt5agg.] This is with Python 3.6.
    Correction: The original comment above (now in brackets) is incorrect. Both versions provide matplotlibrc files in which the backend is macosx. The conda recipes are not modifying the default that we supply.

  16. cbrnr commented on Nov 25, 2017

    ContributorAuthor

    How did you check this? When I start IPython in Anaconda, I get:

    In [1]: %matplotlib
    Using matplotlib backend: MacOSX
    

    Also, matplotlib.get_backend() returns MacOSX.

  17. efiring commented on Nov 25, 2017

    Member

    @cbrnr, thanks for keeping after this--I wasn't being careful enough. It turns out I didn't check something that I thought I had checked, and the upshot is that my backend was being set from my own matplotlibrc file, not from the one installed by conda.

    Side note: it's far from obvious, but to find out which matplotlibrc file is being used one can call matplotlib.matplotlib_fname().

  18. cbrnr commented on Nov 29, 2017

    ContributorAuthor

    So what's the plan? The best solution would be if Anaconda defaulted their Python executables to a framework build (something everyone else is doing, seems to have no negative side effects and makes Python run smoothly on macOS). Alternatively, as a workaround, they could change the default matplotlib backend to qt5 (on Macs) - not sure if this is feasible though because this would mean introducing PyQt5 as a hard dependency of matplotlib.

  19. Mottl commented on Oct 26, 2018

    Contributor

    @cbrnr, could you test whether the issue is gone with the fix #12633?

    import matplotlib
    matplotlib.use('macosx')
    import matplotlib.pyplot as plt
    plt.plot(1)
    plt.show()
  20. cbrnr commented on Oct 26, 2018

    ContributorAuthor

    I tried, but cloning stalls after an hour or so, so I can't test with this PR. However, I noticed that my example from my initial post does work in Anaconda now. Unless I create a new env, I then get a segfault. So I'm not sure what's wrong with Anaconda on my machine, I never seem to get it to work properly.

  21. Mottl commented on Oct 26, 2018

    Contributor

    @cbrnr, thanks! Keep us informed if possible.

  22. cbrnr commented on Jun 6, 2019

    ContributorAuthor

    I tested with the latest Anaconda packages and this issue has been resolved. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL