torchdiffeq
torchdiffeq copied to clipboard
Possible MacOSX visualization crash
When trying to run ode_demo.py with --viz on macosx I am getting the following crash.
(pytorch) ➜ examples git:(master) python ode_demo.py --viz
2019-04-28 12:17:30.404 python[23732:2807027] -[NSApplication _setup:]: unrecognized selector sent to instance 0x7ffb17c3fd10
2019-04-28 12:17:30.406 python[23732:2807027] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x7ffb17c3fd10'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff4f8cf68b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00007fff76b60c76 objc_exception_throw + 48
2 CoreFoundation 0x00007fff4f9681e4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff4f845b50 ___forwarding___ + 1456
4 CoreFoundation 0x00007fff4f845518 _CF_forwarding_prep_0 + 120
5 libtk8.6.dylib 0x0000000121a2e31d TkpInit + 413
6 libtk8.6.dylib 0x000000012198617e Initialize + 2622
7 _tkinter.cpython-37m-darwin.so 0x000000011dfe7a0f _tkinter_create + 1183
8 python 0x0000000108639116 _PyMethodDef_RawFastCallKeywords + 230
9 python 0x0000000108775e42 call_function + 306
10 python 0x0000000108773aec _PyEval_EvalFrameDefault + 46092
11 python 0x000000010876749e _PyEval_EvalCodeWithName + 414
12 python 0x0000000108637de7 _PyFunction_FastCallDict + 231
13 python 0x00000001086ba381 slot_tp_init + 193
14 python 0x00000001086c4361 type_call + 241
15 python 0x0000000108638ae3 _PyObject_FastCallKeywords + 179
16 python 0x0000000108775ed5 call_function + 453
17 python 0x0000000108773be0 _PyEval_EvalFrameDefault + 46336
18 python 0x00000001086388d5 function_code_fastcall + 117
19 python 0x0000000108775dc7 call_function + 183
20 python 0x0000000108773aec _PyEval_EvalFrameDefault + 46092
21 python 0x000000010876749e _PyEval_EvalCodeWithName + 414
22 python 0x0000000108637de7 _PyFunction_FastCallDict + 231
23 python 0x000000010863bce2 method_call + 130
24 python 0x0000000108639752 PyObject_Call + 130
25 python 0x0000000108773d58 _PyEval_EvalFrameDefault + 46712
26 python 0x000000010876749e _PyEval_EvalCodeWithName + 414
27 python 0x0000000108638fe3 _PyFunction_FastCallKeywords + 195
28 python 0x0000000108775dc7 call_function + 183
29 python 0x0000000108773be0 _PyEval_EvalFrameDefault + 46336
30 python 0x000000010876749e _PyEval_EvalCodeWithName + 414
31 python 0x00000001087ca9a0 PyRun_FileExFlags + 256
32 python 0x00000001087c9e17 PyRun_SimpleFileExFlags + 391
33 python 0x00000001087f7d3f pymain_main + 9663
34 python 0x000000010860b66d main + 125
35 libdyld.dylib 0x00007fff7777a015 start + 1
36 ??? 0x0000000000000003 0x0 + 3
Following advice here I inserted the following above if args.viz at aprox ln 57
from sys import platform as sys_pf
if sys_pf == 'darwin':
import matplotlib
matplotlib.use("TkAgg")
And it ran fine.