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
matplotlib 3 pyplot on MacOS bounces rocket icon in dock #12188
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
importmatplotlib.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
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
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
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.
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')
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).
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.
Reacted by Andrew Jaffe, Tara, Hadrien Jean, Louis Yang, Thomas David Baker, Iliyan Georgiev and Johnny Li
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...
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.
$ 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
@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.
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.
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.
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...
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
I cannot reproduce with python3 3.9.1 from homebrew, neither by calling
python3 test.py
importmatplotlib.pyplotasplt
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.
Activity
[-]`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[/+][-]`import matplotlib.pyplot` with matplotlib 3 on MacOS always bounces rocket icon in dock[/-][+] matplotlib 3 pyplot on MacOS bounces rocket icon in dock[/+]tacaswell commentedon Sep 20, 2018
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.
defjaf commentedon Sep 21, 2018
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
.matplotlibdirectory 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, withFileNotFoundError: [Errno 2] No such file or directory: '/Users/jaffe/.matplotlib/fontlist-v300.json')defjaf commentedon Sep 21, 2018
Perhaps I should ask if anyone else on MacOS is (or isn't) seeing this behaviour?
defjaf commentedon Sep 21, 2018
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).
gsportelli commentedon Sep 21, 2018
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.
jklymak commentedon Sep 21, 2018
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.
defjaf commentedon Sep 21, 2018
To be clear:
matplotlibrc, fixed (not bouncing) icon if launched with gui backend (as in the Dr Drang post)jklymak commentedon Sep 21, 2018
That is hard to understand, and my guess is that its always choosing the same backend, depsite your intentions
Can you put
at the top of your script and check that its really giving the intended backend?
defjaf commentedon Sep 21, 2018
Yep:
bounce - bounce - bounce
gsportelli commentedon Sep 21, 2018
I can confirm that with Python 3 and Matplotlib 2.2.2 the icon does not show up.
jklymak commentedon Sep 21, 2018
@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.
53 remaining items
defjaf commentedon Oct 25, 2018
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.
tacaswell commentedon Oct 25, 2018
I wonder if this is somehow related to readline.....
anntzer commentedon Oct 25, 2018
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?
jklymak commentedon Oct 29, 2018
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...
nielskou commentedon May 27, 2019
I had this problem in matplotlib==3.0, upgrading to 3.1 solved my problem.
neilyoung commentedon Jun 14, 2021
3.4.2 bounce bounce bounce :/
jklymak commentedon Jun 14, 2021
@neilyoung please open a new issue with version info, and exactly how you installed Matplotlib and python. Thanks!
neilyoung commentedon Jun 14, 2021
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.4jklymak commentedon Jun 14, 2021
How did you install python 3.9, and what does "installed globally" mean?
neilyoung commentedon Jun 14, 2021
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
jklymak commentedon Jun 14, 2021
I cannot reproduce with python3 3.9.1 from homebrew, neither by calling
python3 test.pynor 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.
neilyoung commentedon Jun 14, 2021
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