0

I have a new macOS laptop with recent Anaconda Python 3.7 installation. I use iTerm2 to open two bash command windows; from the first one I run Python and in the second one I just type "idle" which the Anaconda installation set as a command to start its version of IDLE IDE. Yes, it's for beginners but I just like it.

After a while of running scripts which open plots, the first window where I'm working freezes and I can no longer type. This usually happens after I have plotted something with matplotlib.

The recovery is to close iTerm and Idle and start all over again.

Since this involves some combination of OS and bash and Python I'm not sure where to ask this question, so I thought I would try here first.

Question: Why does launching IDLE from a second terminal window eventually lead to it freezing both? What's a good workaround or fix?


Update: There are warnings in the second iTerm2 window when I start IDLE, this may be the source of the problem:

DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.
2020-08-03 17:08:26.299 Python[561:6540] CoreText note: Client requested name ".SFNSMono-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-08-03 17:08:26.300 Python[561:6540] CoreText note: Set a breakpoint on CTFontLogSystemFontNameRequest to debug.
2020-08-03 17:08:26.385 Python[561:6540] CoreText note: Client requested name ".SF NS Mono", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-08-03 17:08:26.411 Python[561:6540] CoreText note: Client requested name ".SFNSMono-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-08-03 17:08:26.411 Python[561:6540] CoreText note: Client requested name ".sf ns mono", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
5
  • My sincere apologies. In looking for some hard examples in response to your comments on my original answer, I have realized it was likely too speculative, so I have removed it. In fact, it seems that individually speaking, matplotlib, numpy and IDLE can all cause Python to crash on MacOS (independent of terminal hangs broadly or other issues with MacOS itself). But to answer your original comments... Aug 1, 2020 at 2:14
  • 1) "Why would crashing Python cause terminal windows to freeze?" - My understanding is that terminal hangs can occur because the underlying application(s) it is interacting with becomes unresponsive and it isn't always possible to recover from this state. But my understanding could be flawed. Aug 1, 2020 at 2:15
  • 2A) "Is this interaction documented anywhere?" - Apparently not anywhere easily listed on Google, it seems. But you can Google "matplotib numpy crash macos" for a some examples of matplotlib and numpy (and even IDLE) having issues on Mac. Aug 1, 2020 at 2:15
  • 2B) "Is this a personal theory or a known issue?" - The issue that inspired my original supposition is (as far as I am aware) a known issue relating to matplotlib making calls which "vanilla" numpy tries using OpenBLAS for. And unfortunately, OpenBLAS doesn't always work correctly, depending on the OS or other factors. Aug 1, 2020 at 2:17
  • @Anaksunaman I've just updated the question, it seems there are several warning that I was ignoring.
    – uhoh
    Aug 3, 2020 at 9:12

1 Answer 1

1

The Apple-supplied tcl/tk 8.5.9 is about a decade old and is known to be buggy and prone to crashes. (Clearly, Apple does not want one to use it, or it would update it.) Hence Python programs like IDLE that use tk 8.5.9 via tkinter and use a variety of its features are prone to crashing -- unpredictably.

Until a couple of years ago, python.org had a page for Mac tkinter users explaining how to download and install a more recent tcl/tk from ActiveState. The current python.org installers for 2.7.16, 3.7, 3.8, and 3.9 install tcl/tk 3.6.8, which runs much better. (But Catalina changed graphics enough to introduce some new incompatibilities.)

Python core developers have no responsibility for Anaconda and how it compiles _tkinter.c (whether to run with tcl/tk 8.5 or 8.6) and whether it installs a usable tcl/tk as part of the distribution.

1
  • Thanks for your reply! I will continue to check the behavior of the newest IDLE to see if it doesn't happen, and if I can't reproduce it in a few days I'll let you know and we can consider this solved.
    – uhoh
    Aug 22, 2020 at 22:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .