9

After updating my 2019 Macbook Pro yesterday to MacOS Mojave 10.14.6, a tkinter application that I have packaged with pyinstaller now crashes my computer. The screen turns black for a second, and then restarts to the login screen. When I run the program through the command line (unpackaged), it runs just fine.

The error code that appears several times in terminal is: CGSTrackingRegionSetIsEnabled returned CG error 268435459.

The research I've done has led me to these links:

  1. This unanswered StackOverflow question
  2. This semi-related SuperUser question
  3. This question on the Japanese Q&A site teratail

The unanswered StackOverflow question is slightly different than my own problem, as it seems that that user cannot create a Tk() window at all, whereas I can create a Tk() window (including the Python IDLE), but it breaks when I package it with pyinstaller.

The SuperUser question is unanswered, but as one of the answers suggest I have uninstalled and reinstalled pyinstaller to no avail.

The question on teratail was answered, and says that the problem was fixed by uninstalling "Anaconda", but I don't know what Anaconda is or how to uninstall it.

I suspect that this is a problem with the MacOS update, and that there is nothing I can do to fix it and I'll have to wait for a patch.

Why is this happening? How can I fix it?

FIGBERT
  • 193
  • 1
  • 9

5 Answers5

3

This problem has troubled me for a long time. My macOS version is 10.14.6 (Mojave). Running tkinter will crash the system, but I don’t want to update macOS version to 10.15 (Catalina) for this problem.

I got a solution by updating the python version.

My own test results, python versions 3.8.2 and 3.8.3 can fix the problem, but python versions 3.8.1, 3.7.x, 3.6.x will cause the crash.

Kangkai
  • 41
  • 2
2

I can confirm that this happens with Python 3.7.x. Moving to 3.8.3 fixes the problem.

Petio Petrov
  • 123
  • 1
  • 9
  • That fixes it. And this is the **only** thing that fixed it. Other purported solutions — like changing the rendering backend — did nothing. – Konrad Rudolph Jul 09 '20 at 14:32
  • I'm developing an app on Mac OS 10.14.5 using Python 3.9.6, Tk 8.6, and py2app. It compiles and runs as a standalone app for 10.14.5 just fine but I'm experiencing the same error described in the original post when running it on 10.14.6. When you say that "moving to 3.8.3 fixes the problem", are you saying that the app needs to be compiled on Python 3.8.3, or Python 3.8.3 needs to be installed on the 10.14.6 computer? I don't have the luxury of being able to downgrade the 10.14.6 Mac, or upgrading it to Catalina. – Dan Curry Jul 19 '21 at 19:06
  • That's right, you need to compile using 3.8.3. In fact, when you package with PyInstaller, you should not need to have Python installed on the machine you run your app on at all. – Petio Petrov Jul 20 '21 at 20:12
1

Workaround: boot in Safe Mode.. (Other apps are experiencing this.)

The macOS Window Server is crashing.. The Console.app contains the crash report in the "System Reports" node.

Process: WindowServer Thread 0 (main thread) crashes in CGXBeginSurfaceLayerUpdate

Brian
  • 11
  • 1
  • seems to be related to code using [NSColorSpace deviceRGBColorSpace] maybe Apple can fix their Window Server in an Update.. or rebuild tk to not use deviceRGBColorSpace. – Brian Aug 13 '19 at 21:57
1

I had the same problem with Mac OSX 10.14.6 completely crashing with no error messages and logging me out or rebooting. It was fixed by removing Anaconda and using the python.org ver 3.7.4. A good link for removing Anaconda is here. How to uninstall Anaconda completely from macOS

  • Fascinating. Is it possible that just switching to version 3.7.4 would do it? How did you arrive at the conclusion of Anaconda? – Petio Petrov Jul 02 '20 at 14:45
0

The new MacOS Catalina (Version 10.15) update seems to fix the problem for me. By specifying the tcl version and making sure the right tcl is used, I was able to successfully bundle and run my python script with tkinter. Yay!

FIGBERT
  • 193
  • 1
  • 9
  • Query: After upgrading to 10.15 do I have to recompile with pyinstaller or is the problem simply resolved and can I open a previously compiled executable? – Geynen Mar 11 '20 at 19:08