NSException for Pyplot


#1

I am getting the following exception when attempting to plot using pyplot:

julia> using Plots

julia> pyplot()
Plots.PyPlotBackend()

julia> plot(rand(100))
2019-01-08 10:43:51.574 julia[90768:45265541] -[NSApplication _setup:]: unrecognized selector sent to instance 0x7f964ddbdff0
2019-01-08 10:43:51.575 julia[90768:45265541] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x7f964ddbdff0'
*** First throw call stack:
(
        0   CoreFoundation                      0x00007fff3a4b2fcb __exceptionPreprocess + 171
        1   libobjc.A.dylib                     0x00007fff61164c76 objc_exception_throw + 48
        2   CoreFoundation                      0x00007fff3a54ba24 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
        3   CoreFoundation                      0x00007fff3a429610 ___forwarding___ + 1456
        4   CoreFoundation                      0x00007fff3a428fd8 _CF_forwarding_prep_0 + 120
        5   libtk8.6.dylib                      0x0000000144f7631d TkpInit + 413
        6   libtk8.6.dylib                      0x0000000144ece17e Initialize + 2622
        7   _tkinter.cpython-37m-darwin.so      0x0000000144cf6a0f _tkinter_create + 1183
        8   libpython3.7m.dylib                 0x0000000129eda2b9 _PyMethodDef_RawFastCallKeywords + 681
        9   libpython3.7m.dylib                 0x0000000129eda3bd _PyCFunction_FastCallKeywords + 45
        10  libpython3.7m.dylib                 0x0000000129fe3c4b call_function + 603
        11  libpython3.7m.dylib                 0x0000000129fdae45 _PyEval_EvalFrameDefault + 7893
        12  libpython3.7m.dylib                 0x0000000129fd8ad9 _PyEval_EvalCodeWithName + 3305
        13  libpython3.7m.dylib                 0x0000000129ed91b1 _PyFunction_FastCallDict + 481
        14  libpython3.7m.dylib                 0x0000000129edaba4 _PyObject_Call_Prepend + 164
        15  libpython3.7m.dylib                 0x0000000129f425aa slot_tp_init + 298
        16  libpython3.7m.dylib                 0x0000000129f4bca7 type_call + 295
        17  libpython3.7m.dylib                 0x0000000129ed9e73 _PyObject_FastCallKeywords + 691
        18  libpython3.7m.dylib                 0x0000000129fe3cb4 call_function + 708
        19  libpython3.7m.dylib                 0x0000000129fdaf6c _PyEval_EvalFrameDefault + 8188
        20  libpython3.7m.dylib                 0x0000000129ed9a6e function_code_fastcall + 254
        21  libpython3.7m.dylib                 0x0000000129fe3cbe call_function + 718
        22  libpython3.7m.dylib                 0x0000000129fdae45 _PyEval_EvalFrameDefault + 7893
        23  libpython3.7m.dylib                 0x0000000129fd8ad9 _PyEval_EvalCodeWithName + 3305
        24  libpython3.7m.dylib                 0x0000000129ed91b1 _PyFunction_FastCallDict + 481
        25  libpython3.7m.dylib                 0x0000000129edaba4 _PyObject_Call_Prepend + 164
        26  libpython3.7m.dylib                 0x0000000129edc5b4 method_call + 36
        27  libpython3.7m.dylib                 0x0000000129eda5b6 PyObject_Call + 246
        28  libpython3.7m.dylib                 0x0000000129fdb1b5 _PyEval_EvalFrameDefault + 8773
        29  libpython3.7m.dylib                 0x0000000129fd8ad9 _PyEval_EvalCodeWithName + 3305
        30  libpython3.7m.dylib                 0x0000000129ed91b1 _PyFunction_FastCallDict + 481
        31  ???                                 0x0000000124c9b06a 0x0 + 4912164970
        32  ???                                 0x0000000124ca4507 0x0 + 4912203015
        33  ???                                 0x0000000145935508 0x0 + 5462250760
        34  libjulia.1.0.dylib                  0x000000010b7e4ac3 jl_fptr_trampoline + 51
        35  ???                                 0x0000000145935416 0x0 + 5462250518
        36  libjulia.1.0.dylib                  0x000000010b7f54b2 jl_f__apply + 1218
        37  libjulia.1.0.dylib                  0x000000010b7f594f jl_f__apply_latest + 63
        38  ???                                 0x00000001459353a5 0x0 + 5462250405
        39  libjulia.1.0.dylib                  0x000000010b7f54b2 jl_f__apply + 1218
        40  ???                                 0x000000014593321e 0x0 + 5462241822
        41  ???                                 0x0000000145933344 0x0 + 5462242116
        42  ???                                 0x0000000124c7f5e6 0x0 + 4912051686
        43  ???                                 0x0000000124c8151c 0x0 + 4912059676
)
libc++abi.dylib: terminating with uncaught exception of type NSException

signal (6): Abort trap: 6
in expression starting at no file:0
__pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line)
Allocations: 79194240 (Pool: 79179525; Big: 14715); GC: 175
zsh: abort      julia

I am using julia 1.0.1 with:

  [91a5bcdd] Plots v0.22.4
  [438e738f] PyCall v1.18.5
  [d330b81b] PyPlot v2.6.3

I would appreciate any help! I have updated and resolved the packages. My thoughts for next steps are just reinstall the packages or julia itself.

Thanks :slight_smile:


#2

Following the advice here: https://github.com/JuliaPy/PyPlot.jl/issues/405,
I ran:

using Conda
Conda.add("pyqt")

This effectively changed the PyPlot backend from "tkagg" to "qt5agg". I am on Mac by the way. Not sure if I solved this in the optimal way, but it seems to work for now.