Tag Archives: libc++abi.dylib: terminating with uncaught exception of type NSException

Mac Python3 Conda Pytorch Error: libc++abi.dylib: terminating with uncaught exception of type NSException

The example of running neural network in MAC 10.14/conda/python 3.7 environment is wrong

2019-03-19 17:07:55.982 python[1556:126911] -[NSApplication _setup:]: unrecognized selector sent to instance 0x7fd5a5811270
2019-03-19 17:07:55.988 python[1556:126911] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x7fd5a5811270'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff3c94643d __exceptionPreprocess + 256
    1   libobjc.A.dylib                     0x00007fff68853720 objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff3c9c3255 -[NSObject(NSObject) __retain_OA] + 0
    3   CoreFoundation                      0x00007fff3c8e5ad0 ___forwarding___ + 1486
    4   CoreFoundation                      0x00007fff3c8e5478 _CF_forwarding_prep_0 + 120
    5   libtk8.6.dylib                      0x00000001334ee31d TkpInit + 413
    6   libtk8.6.dylib                      0x000000013344617e Initialize + 2622
    7   _tkinter.cpython-37m-darwin.so      0x000000010727aa0f _tkinter_create + 1183
    8   python                              0x0000000105b028b6 _PyMethodDef_RawFastCallKeywords + 230
    9   python                              0x0000000105c3fba2 call_function + 306
    10  python                              0x0000000105c3d852 _PyEval_EvalFrameDefault + 46114
    11  python                              0x0000000105c311fe _PyEval_EvalCodeWithName + 414
    12  python                              0x0000000105b01587 _PyFunction_FastCallDict + 231
    13  python                              0x0000000105b83c31 slot_tp_init + 193
    14  python                              0x0000000105b8dc01 type_call + 241
    15  python                              0x0000000105b02283 _PyObject_FastCallKeywords + 179
    16  python                              0x0000000105c3fc35 call_function + 453
    17  python                              0x0000000105c3d946 _PyEval_EvalFrameDefault + 46358
    18  python                              0x0000000105b02075 function_code_fastcall + 117
    19  python                              0x0000000105c3fb27 call_function + 183
    20  python                              0x0000000105c3d852 _PyEval_EvalFrameDefault + 46114
    21  python                              0x0000000105c311fe _PyEval_EvalCodeWithName + 414
    22  python                              0x0000000105b01587 _PyFunction_FastCallDict + 231
    23  python                              0x0000000105b054a2 method_call + 130
    24  python                              0x0000000105b02ef2 PyObject_Call + 130
    25  python                              0x0000000105c3da9d _PyEval_EvalFrameDefault + 46701
    26  python                              0x0000000105c311fe _PyEval_EvalCodeWithName + 414
    27  python                              0x0000000105b02783 _PyFunction_FastCallKeywords + 195
    28  python                              0x0000000105c3fb27 call_function + 183
    29  python                              0x0000000105c3d88d _PyEval_EvalFrameDefault + 46173
    30  python                              0x0000000105b02075 function_code_fastcall + 117
    31  python                              0x0000000105c3fb27 call_function + 183
    32  python                              0x0000000105c3d88d _PyEval_EvalFrameDefault + 46173
    33  python                              0x0000000105c311fe _PyEval_EvalCodeWithName + 414
    34  python                              0x0000000105b02783 _PyFunction_FastCallKeywords + 195
    35  python                              0x0000000105c3fb27 call_function + 183
    36  python                              0x0000000105c3d88d _PyEval_EvalFrameDefault + 46173
    37  python                              0x0000000105c311fe _PyEval_EvalCodeWithName + 414
    38  python                              0x0000000105b02783 _PyFunction_FastCallKeywords + 195
    39  python                              0x0000000105c3fb27 call_function + 183
    40  python                              0x0000000105c3d852 _PyEval_EvalFrameDefault + 46114
    41  python                              0x0000000105b02075 function_code_fastcall + 117
    42  python                              0x0000000105c3fb27 call_function + 183
    43  python                              0x0000000105c3d88d _PyEval_EvalFrameDefault + 46173
    44  python                              0x0000000105c311fe _PyEval_EvalCodeWithName + 414
    45  python                              0x0000000105c94760 PyRun_FileExFlags + 256
    46  python                              0x0000000105c93bd7 PyRun_SimpleFileExFlags + 391
    47  python                              0x0000000105cc17bf pymain_main + 9583
    48  python                              0x0000000105ad4bbd main + 125
    49  libdyld.dylib                       0x00007fff69921085 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6

To solve this problem, run the following command:

$ mkdir -p ~/.matplotlib
$ echo "backend: TkAgg" > ~/.matplotlib/matplotlibrc

And then it worked

The specific reasons are as follows: https://github.com/PAHdb/AmesPAHdbPythonSuite/issues/1