Open pwilmart opened 5 years ago
I can confirm this happening and have also reproduced it with both miniconda2 and miniconda3 4.7.12 on both macOS 10.4.6; however in my case it doesn't always crash the entire login session - when running a Python script using Tkinter via a GUI application, I managed to get the following stack trace instead:
2019-10-14 10:37:03.143 python[8733:628034] -[QNSApplication _setup:]: unrecognized selector sent to instance 0x7facee3f61e0
2019-10-14 10:37:03.146 python[8733:628034] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[QNSApplication _setup:]: unrecognized selector sent to instance 0x7facee3f61e0'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff4b749b79 __exceptionPreprocess + 256
1 libobjc.A.dylib 0x00007fff75ebe3c6 objc_exception_throw + 48
2 CoreFoundation 0x00007fff4b7c427b -[NSObject(NSObject) __retain_OA] + 0
3 CoreFoundation 0x00007fff4b6eb658 ___forwarding___ + 1478
4 CoreFoundation 0x00007fff4b6eb008 _CF_forwarding_prep_0 + 120
5 libtk8.6.dylib 0x000000011c14531d TkpInit + 413
6 libtk8.6.dylib 0x000000011c09d17e Initialize + 2622
7 _tkinter.cpython-37m-darwin.so 0x000000011bec5a0f _tkinter_create + 1183
8 python 0x0000000101f12116 _PyMethodDef_RawFastCallKeywords + 230
9 python 0x000000010204ee42 call_function + 306
10 python 0x000000010204caec _PyEval_EvalFrameDefault + 46092
11 python 0x000000010204049e _PyEval_EvalCodeWithName + 414
12 python 0x0000000101f10de7 _PyFunction_FastCallDict + 231
13 python 0x0000000101f93381 slot_tp_init + 193
14 python 0x0000000101f9d361 type_call + 241
15 python 0x0000000101f11ae3 _PyObject_FastCallKeywords + 179
16 python 0x000000010204eed5 call_function + 453
17 python 0x000000010204caec _PyEval_EvalFrameDefault + 46092
18 python 0x0000000101f118d5 function_code_fastcall + 117
19 python 0x000000010204edc7 call_function + 183
20 python 0x000000010204cb27 _PyEval_EvalFrameDefault + 46151
21 python 0x000000010204049e _PyEval_EvalCodeWithName + 414
22 python 0x00000001020a39a0 PyRun_FileExFlags + 256
23 python 0x00000001020a2e17 PyRun_SimpleFileExFlags + 391
24 python 0x00000001020d0d3f pymain_main + 9663
25 python 0x0000000101ee466d main + 125
26 libdyld.dylib 0x00007fff776833d5 start + 1
27 ??? 0x0000000000000005 0x0 + 5
)
libc++abi.dylib: terminating with uncaught exception of type NSException
/Users/piesche/CCDC/CSD_2019/mercury.app/Contents/MacOS/api_launcher.sh: line 50: 8733 Abort trap: 6 "$@"```
@pwilmart does your script, or any wrapper around it, happen to make use of Qt/QApplication
objects or matplotlib
as well? I've found a bug in our internal bug tracker reporting this on macOS 10.13, with a similar stack trace to the one above and a workaround eventually found of not creating a QApplication
and a note saying that matplotlib also has trouble coexisting with Tkinter on macOS.
I have just one script of about a half dozen that uses Matplotlib with tkinter, the others do not. I do not use Qt.
The following simple script crashes macos every time, both with the command line and in spyder.
My own code crashes at the first executable line, a TK call (last line below):
from pwscf_analyzer import PwscfAnalyzer import tkinter as tk import tkFileDialog
def run_statsandplot(Event): begin = tk.IntVar() begin=e1.get()
# weak attempt at equilibration detection
# automatic estimation of autocorrelation
#print pa.md_stats
# equilibration time specified, estimate autocorrelation
print ("Cutting off {0} steps for equilibration".format(begin))
print("Mean StdErrorMean Correlation Time (steps)")
print ("begin=",begin)
print (pa.md_statistics(equil=int(begin)))
# equilibration and autocorrelation time specified
#print pa.md_statistics(equil=20,autocorr=45)
#end if
pa.md_plots(filename,int(begin))
root = tk.Tk()
By downgrading python to 2.7.13 I get the following traceback at the root=tk.TK() line instead of crashing the mac:
(py2) bash-3.2$ python ~/Dropbox/Github/qmcpack/nexus/lib/analyze_pwscf_md.py 2019-11-06 15:57:19.599 python[3679:1692342] -[NSApplication _setup:]: unrecognized selector sent to instance 0x7fbc51df1ec0 2019-11-06 15:57:19.600 python[3679:1692342] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x7fbc51df1ec0' First throw call stack: ( 0 CoreFoundation 0x00007fff3ad04b79 exceptionPreprocess + 256 1 libobjc.A.dylib 0x00007fff6547d3c6 objc_exception_throw + 48 2 CoreFoundation 0x00007fff3ad7f27b -[NSObject(NSObject) retain_OA] + 0 3 CoreFoundation 0x00007fff3aca6658 forwarding + 1478 4 CoreFoundation 0x00007fff3aca6008 _CF_forwarding_prep_0 + 120 5 libtk8.6.dylib 0x0000000107ddf31d TkpInit + 413 6 libtk8.6.dylib 0x0000000107d3717e Initialize + 2622 7 _tkinter.so 0x0000000107b62bf4 Tcl_AppInit + 84 8 _tkinter.so 0x0000000107b62458 Tkinter_Create + 1128 9 libpython2.7.dylib 0x00000001077f3d84 PyEval_EvalFrameEx + 23044 10 libpython2.7.dylib 0x00000001077ee124 PyEval_EvalCodeEx + 2164 11 libpython2.7.dylib 0x00000001077706d3 function_call + 355 12 libpython2.7.dylib 0x00000001077483d5 PyObject_Call + 101 13 libpython2.7.dylib 0x0000000107757182 instancemethod_call + 162 14 libpython2.7.dylib 0x00000001077483d5 PyObject_Call + 101 15 libpython2.7.dylib 0x00000001077f7e9f PyEval_CallObjectWithKeywords + 159 16 libpython2.7.dylib 0x0000000107755114 PyInstance_New + 148 17 libpython2.7.dylib 0x00000001077483d5 PyObject_Call + 101 18 libpython2.7.dylib 0x00000001077f3a08 PyEval_EvalFrameEx + 22152 19 libpython2.7.dylib 0x00000001077ee124 PyEval_EvalCodeEx + 2164 20 libpython2.7.dylib 0x00000001077ed8a2 PyEval_EvalCode + 34 21 libpython2.7.dylib 0x000000010781b22d PyRun_FileExFlags + 157 22 libpython2.7.dylib 0x000000010781ad70 PyRun_SimpleFileExFlags + 816 23 libpython2.7.dylib 0x0000000107831932 Py_Main + 3506 24 libdyld.dylib 0x00007fff66c423d5 start + 1 25 ??? 0x0000000000000002 0x0 + 2 ) libc++abi.dylib: terminating with uncaught exception of type NSException Abort trap: 6 (py2) bash-3.2$
However with the downgraded python the tktest.py code DOES work! Strange.
Ron Cohen
With
python 2.7.13 h89fad4f_16
and
tk 8.6.8 ha441bb4_0
my code works if I change the order of the import statements (see below).
If I then upgrade python to 2.7.16 it still works.
If I then say: conda upgrade tk
then it crashes my whole mac to a black screen.
conda list --revisions shows for that last upgrade:
2019-11-07 09:26:45 (rev 8) blas {1.0 -> 1.0} numpy {1.16.5 -> 1.16.5} numpy-base {1.16.5 -> 1.16.5} scipy {1.2.1 -> 1.2.1} -libopenblas-0.3.6 -xz-5.2.4 +intel-openmp-2019.4 +mkl-2019.4 +mkl-service-2.3.0 +mkl_fft-1.0.15 +mkl_random-1.1.0
I do not know why that should interact with tk!!
I am trying to downgrade tk to 8.6.7 and try that with python 2.7.16 but it finds many conflicts and conda has been running for over half an hour trying to resolve.
Does anyone have further information on this problem? It is a pain having one's computer crash with tests!
Sincerely,
Ron
import Tkinter as tk import tkFileDialog root = tk.Tk() root.withdraw() filename = tkFileDialog.askopenfilename(parent=root,title="Select QE MD output file" )
from pwscf_analyzer import PwscfAnalyzer
This may be related to #11165
Actual Behavior
Python scripts using tkinter (several of my scripts and also IDLE) that worked in the past have stopped working. The problem is that running any script that uses tkinter logs me out of the Mac rather than launching. If I create an environment with Python 3.5, things work fine. Python 3.6 and 3.7 environments do not work. I update my Mac OS regularly. I cannot say if the problems have any correlation with any Mac system updates, but I think it is more related to the new Python updates.
I downloaded a non-Anaconda Python 3.7 from www.python.org, installed that, and everything runs just fine. I also have Windows 10 running on a virtual machine and there are no problems on the Windows side with the Python 3.7 Anaconda distribution.
Expected Behavior
When launching Python scripts that use tkinter from the standard library, they should launch and run instead of logging me out of my account.
Steps to Reproduce
Launching IDLE from the command line (this is an "idle3" command on the Mac), or running any Python script that uses the tkinter library will cause a rapid logout of my account on the Mac. It does not cause a reboot, "just" a log out.
Anaconda or Miniconda version:
The version from this installer: Anaconda3-2019.07-MacOSX-x86_64.pkg
Operating System:
Mac OSX Mojave (10.14.6), computer: 2017 iMac 27" and late 2016 MacBook
conda info
conda list --show-channel-urls