Tkinter crashes computer after MacOS 10.14.6 update - python-3.x

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:
This unanswered StackOverflow question
This semi-related SuperUser question
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?

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.

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

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

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

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!

Related

Corrupted visual from python chromeos linux

I am using a chromebook with linux beta turned on to use a terminal to run python3 scripts. they worked fine until recently when any pop out window (pygame, pyplot) look corrupted. the windows have black bars covering them for pyplot or are completely covered in black for pygame. the code in the python scripts are unchanged and worked just fine a couple of weeks ago.
I have already turned off linux beta, then returned it back on, reinstalling packages which didn't alleviate the issue. Any help is IMMENSELY appreciated!!
I installed Qt5 bindings via pip install PyQt5 and changed the backend to Qt5Agg per How to change backends in matplotlib / Python and that fixed the black bars for me.

Python, Anaconda & PyCharm multiple versions of Python3

I just installed Anaconda3-2019-10 on my MacBook.
I tried to make sure that my previous Python 3 version was totally uninstalled / removed from my system. Typing python3to the terminal didn´t work anymore.
After installing Anaconda and PyCharm (pycharm-community-anaconda-2019.3.3) I started a new Project to test everything. For that I selected to create a new Conda environment:
After I created the process I checked the Preferences and the "Project Interpreter". This is what I found:
I expected to find two interpreters 1.) my 3.7 Python version and 2.) the Conda environment just created.
Does finding 3 versions mean that I didn´t correctly deinstall Python3 before installing anaconda or is there anything that I don´t understand here?
Do I need both versions?
If not is there a safe way to remove one of them?
For removing Python3 from my system I did almost everythin suggested in numerous posts in Stackoverflow.
Upon creating a venv(virtual environment) you no longer need to worry about the existing interpreter. https://docs.python.org/3/tutorial/venv.html this might be of help.

Mac OS (Mojave) - Pycharm backend : TkAgg not working, graphs are blank

I am fairly new to python (and Stackflow) so apologies if this is a repost. I am currently run Pycharm on my iMac (with Mac OS Mojave), python install from Anaconda.
I am having some issues with Matplotlib as everytime I plot a graph I don't see anything. The backend currently uses TkAgg. I googled the issue and came across many links and tried to change the backend in matplotlibrc, but that just gave me errors.
It is Mojave specific problem? I have another Mac with High Sierra (which uses MacOSX in the backend) and Matplotlib runs fine on it. I tried changing the backend on my iMac to MacOSX but that doesn't work. Any help will be really appreciated as I have already spend more than 3-4 hours (in vain!) to fix the problem
If I need to change the backend in matplotlibrc, could you advise what should I be using?
thanks,
PK
if you use virtualenv in Mojave, you have to install matplotliv (v1.3.1) at virtualenv. ** NOT VERSION 2.2.3 **. so, try the below command (btw, in your code, 'TkAgg' is needless):
$pip install --no-cache-dir matplotlib==1.3.1
everything will be fine.

Spyder not launching in python 3.7

Several days ago, Spyder stopped running. I tried almost everything on forums. I desinstalled it and downloaded last version of anaconda package, but to no avail.
This is what the anaconda prompt shows me
As I said, I tried uploading qt, PySide, and even tried to locate .spyder2 to erase it as is said in Anaconda webpage.
I really don't know what else to try
EDIT: Don't know if you need versions of anything, because as I said, it is the standard last version package available in Anaconda.
EDIT2: I'm using Windows 10

Updating Python version from command prompt and Conversion from PyQt4 to PyQt5

Running: Ubuntu 16.04 and Python 3.5.2
So I ran a script which I found here: https://github.com/rferrazz/pyqt4topyqt5
in order to convert one of my projects built in PyQt4 into a PyQt5 project.
I ran the script and the conversion was made just fine with no errors. Essentially, everywhere QtGui() was used was changed to QtWidgets(). The only problem, when I try to run the new PyQt5 project I get the following error:
ImportError: /usr/local/lib/python3.5/dist-packages/PyQt5/QtGui.so: undefined symbol: PySlice_AdjustIndices
I am not positive but it seemed to me this would be a version error of some kind, which brings me to my questions. Is there a method of updating Python from 3.5 to the newest version release which I believe is 3.7 from the command prompt? Also, is the ImportError I got a version control issue like I believe it to be?
The solution to this problem ended up being a version problem from what I can tell. I installed py3.7 from source using pyenv, drove the script with that interpreter through PyCharm and was able to run it.

Resources