Skip to content

matplotlib 3 pyplot on MacOS bounces rocket icon in dock #12188

Closed

Description

@defjaf

Bug report

Bug summary

Rocket icon appears in dock (and bounces) when matplotlib.pyplot is imported after installing matplotlib 3.0. In previous versions, this didn't happen (and still doesn't with python2 on the same machine)

Code for reproduction

import matplotlib.pyplot 

Actual outcome
Rocket icon appears in MacOS dock and bounces for a while.

Expected outcome
Nothing (no dock icon for previous versions).

Matplotlib version

  • Operating system: MacOS
  • Matplotlib version: 3
  • Matplotlib backend: any (seems to happen no matter what is set in matplotlibrc)
  • Python version: 3.7 (Python.org framework build)

Installed from pip.

I haven't seen any other complaints about this, so I suspect that there is something specific to my setup.

Perhaps related to this ipython issue (but this happens even from the plain python3 REPL.) I

Activity

  1. changed the title [-]`import matplotlib.pyplot` with matplotlib 3 on MacOS always put rocket icon in dock[/-] [+]`import matplotlib.pyplot` with matplotlib 3 on MacOS always bounces rocket icon in dock[/+] on Sep 20, 2018
  2. changed the title [-]`import matplotlib.pyplot` with matplotlib 3 on MacOS always bounces rocket icon in dock[/-] [+] matplotlib 3 pyplot on MacOS bounces rocket icon in dock[/+] on Sep 20, 2018
  3. tacaswell commented on Sep 20, 2018

    @tacaswell
    Member

    Is python hung while it is bouncing? If so I suspect that this is related to the font search issue (see #12176 / #12177 ). We have a fix in, and there will likely be a 3.0.1 in a few weeks. For now I suggest either going to an empty directory, doing the import there to let the font cache build.

  4. added this to the v3.0.x milestone on Sep 20, 2018
  5. defjaf commented on Sep 21, 2018

    @defjaf
    Author

    No, I don't think it's that. Python and matplotlib are running just fine with the icon in the dock.

    (Aside: I do think I've separately encountered the font search issue, however -- when diagnosing this, I tried to remove my .matplotlib directory and definitely found several issues with the system trying to set up fonts: 1. it stops whenever it finds a bad symlink anywhere in my filesystem; 2. Even after I fixed all of those, it still eventually failed, after more than 20 minutes, with FileNotFoundError: [Errno 2] No such file or directory: '/Users/jaffe/.matplotlib/fontlist-v300.json')

  6. defjaf commented on Sep 21, 2018

    @defjaf
    Author

    Perhaps I should ask if anyone else on MacOS is (or isn't) seeing this behaviour?

  7. defjaf commented on Sep 21, 2018

    @defjaf
    Author

    See also this post from Dr Drang regarding Python 2.7 in 2014, although I think the icon doesn't bounce in that case.

    Note that the plist hack still works, but matplotlib.use("Agg") doesn't anymore. Could this be due to the fallback backend search?

    But this brings up another question: I don't see this behaviour under Python 2.7. I can get a non-bouncing icon in the dock if I set to a GUI backend, but never a bouncing icon (and no icon if I have a non-GUI backend).

  8. gsportelli commented on Sep 21, 2018

    @gsportelli

    I have the same problem. The rocket icon starts bouncing after importing matplotlib.pyplot only if I upgrade from matplotlib==2.2.2 to matplotlib==3.0.0.

  9. jklymak commented on Sep 21, 2018

    @jklymak
    Member

    This is somewhat confusing as Matplotlib 3.0.0 does not run under python 2.7. So did you mean Matplotlib 2.2.x doesn't bounce?

    I have a Mac and I never see the rocket icon after I set my backend to Qt5Agg. Have you tried setting this in ~/.matplotlib/matplotlibrc? Its possible the new renderer fallback is not working properly...

    This'll be hard for me to debug - I use conda for my install, not python.org + pip. If you go that route, its entirely possible there are mismatched libraries, and you should consider upgrading all the non-python dependencies...

    Sorry to not be more helpful.

  10. defjaf commented on Sep 21, 2018

    @defjaf
    Author

    To be clear:

    • Python 3 + Matplotlib 3: bounces no matter what backend
    • Python 2.7 + Matplotlib 2.2x: gives no icon if launched without a gui backend in matplotlibrc, fixed (not bouncing) icon if launched with gui backend (as in the Dr Drang post)
    • Python 3 + Matplotlib 2.2x: I don’t have this setup on my machine right now, but I recall that it behaves as on Python 2.7.
  11. jklymak commented on Sep 21, 2018

    @jklymak
    Member
    • Python 3 + Matplotlib 3: bounces no matter what backend

    That is hard to understand, and my guess is that its always choosing the same backend, depsite your intentions

    Can you put

    import matplotlib
    print(matplotlib.get_backend())

    at the top of your script and check that its really giving the intended backend?

  12. defjaf commented on Sep 21, 2018

    @defjaf
    Author

    Yep:

    $ python3
    Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24) 
    [Clang 6.0 (clang-600.0.57)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import matplotlib
    >>> matplotlib.get_backend()
    'agg'
    >>> import matplotlib.pyplot as plt
    

    bounce - bounce - bounce

  13. gsportelli commented on Sep 21, 2018

    @gsportelli

    I can confirm that with Python 3 and Matplotlib 2.2.2 the icon does not show up.

  14. jklymak commented on Sep 21, 2018

    @jklymak
    Member

    @defjaf Sorry, I can't reproduce conda py3.7, mpl3.0.0. I don't get any icons in the doc until I do plt.show(). Must be something funky w. the framework build.

  15. 53 remaining items

  16. modified the milestones: v3.0.1, v3.0.x on Oct 25, 2018
  17. defjaf commented on Oct 25, 2018

    @defjaf
    Author

    Hi @tacaswell and @jklymak: I have managed to get master running here, and it does seems to solve the problems as stated: the icon only shows up for the macOSX backend. Curiously, and perhaps related to previous comments, it bounces from the standard REPL, but the icon appears without bouncing in ipython or jupyter.

  18. tacaswell commented on Oct 25, 2018

    @tacaswell
    Member

    I wonder if this is somehow related to readline.....

  19. anntzer commented on Oct 25, 2018

    @anntzer
    Contributor

    Alternatively the call to SetFrontProcess might be causing the bouncing. Maybe if there is a way to un-set the front process (set it back to what it was before that call?) that would stop the bouncing.

    Indeed, perhaps it'll help to first call GetFrontProcess (https://developer.apple.com/documentation/applicationservices/1501050-getfrontprocess?language=objc) before doing all that manipulation, and restore it at the end?

  20. jklymak commented on Oct 29, 2018

    @jklymak
    Member

    I'm going to close because I think this is as good as we are going to get for now. There is a PR for 3.1 (#12633) that might make life even better for mac backend users...

  21. nielskou commented on May 27, 2019

    @nielskou

    I had this problem in matplotlib==3.0, upgrading to 3.1 solved my problem.

  22. neilyoung commented on Jun 14, 2021

    @neilyoung

    3.4.2 bounce bounce bounce :/

  23. jklymak commented on Jun 14, 2021

    @jklymak
    Member

    @neilyoung please open a new issue with version info, and exactly how you installed Matplotlib and python. Thanks!

  24. neilyoung commented on Jun 14, 2021

    @neilyoung

    Thanks for the response. Meanwhile I found a work around by plt.pause(0.0001). For the files: plotlib is 3.4.2, installed globally under python 3.9 at macOS 11.4

  25. jklymak commented on Jun 14, 2021

    @jklymak
    Member

    How did you install python 3.9, and what does "installed globally" mean?

  26. neilyoung commented on Jun 14, 2021

    @neilyoung

    Sorry for not being specific enough. 3.9 comes with brew, install globally means "sudo python3 -m pip install matplotlib==3.4.2"

    EDIT: 3.9 is default with macOS 11

  27. jklymak commented on Jun 14, 2021

    @jklymak
    Member

    I cannot reproduce with python3 3.9.1 from homebrew, neither by calling

    python3 test.py

    import matplotlib.pyplot as plt 

    nor via the REPL. I did not install globally, because that is not a good idea in general, so maybe that is the difference?

    Again, please open a new issue, and explicitly state what you did to install python and what you did to install matplotlib. Further state exactly what steps you took to get the bouncing doc.

  28. neilyoung commented on Jun 14, 2021

    @neilyoung

    This is not my app :)

    I'm running a script in a "for" loop, which updates dots and lines and calls "plt.draw()". This script (not mine) is supposed to work on other OS.

    Again. I'm through with this. For me the pause works.

    Thanks. Don't worry

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

Metadata

Metadata

Labels

OS: AppleRelease criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions