JuliaPy / PyPlot.jl

Plotting for Julia based on matplotlib.pyplot
https://github.com/JuliaPy/PyPlot.jl
MIT License
477 stars 88 forks source link

on OS X, unrecognized selector crash with Julia 0.5 and PyPlot 2.2.4 #253

Closed protogeezer closed 5 years ago

protogeezer commented 8 years ago
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.5.0 (2016-09-19 18:14 UTC)
 _/ |\__'_|_|_|\__'_|  |  
|__/                   |  x86_64-apple-darwin15.6.0

julia> using Gadfly, PyCall, PyPlot
/Users/sjbespa/anaconda2/lib/python2.7/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
  warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')

julia> fig = PyPlot.plt[:figure]()
2016-10-18 14:25:59.951 julia[1413:193212] -[__NSCFType symbolicTraits]: unrecognized selector sent to instance 0x7fe289562d00

If Gadfly is referenced after PyCall and PyPlot, the error doesn't happen...

   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.5.0 (2016-09-19 18:14 UTC)
 _/ |\__'_|_|_|\__'_|  |  
|__/                   |  x86_64-apple-darwin15.6.0

julia> using PyCall, PyPlot, Gadfly
/Users/sjbespa/anaconda2/lib/python2.7/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
  warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')

julia> fig = PyPlot.plt[:figure]()
PyPlot.Figure(PyObject <matplotlib.figure.Figure object at 0x32cfd2d50>)
stevengj commented 8 years ago

Presumably there is no problem if you don't use Gadfly at all?

@tlnagy, any idea why there would be a Gadfly/PyPlot conflict?

protogeezer commented 8 years ago

The literal answer to your question is no - there are frequent crashes with PyPlot and PyCall whether Gadfly is loaded or not. I filed this issue because the crash was reproducible.

So, it's the other way around. I'm trying to figure out how to eliminate the need for Python, or matplotlib in particular. Gadfly is gaining altitude again, and since Gadfly graphics are so much nicer than marplotlib, that's where I'm going to invest my time.

@tlnagy

tlnagy commented 8 years ago

Huh. This is really weird. What's your versioninfo()?

protogeezer commented 8 years ago

Spooky is how i’d describe it. If you need me to jettison all the parts of Gallium I installed in a vain attempt to get the debugger working, let me know.

Aside: When you are able and willing, I’d like to correspond about my interest in building a high performance/full featured graphics backend (or middle layer) for Gadfly. One thought is to sub-in Qt for the quasi-gnome julia seems to favor now. The other thought is to to distinguish Macs with a no-holds-barred Cocoa backend. Either would allow direct use of the window system to manage layouts, and utilize something like VTK and ITK as the 2d/3d engines.

In any event, there isn’t much of a rush - this will be a hobby with the intent of having something by julia 1.0…

The tricky part that I need to make sure I’m totally in sync with is that anything that is truly cross platform and pro-grade will require a redo of the julia runtime - most specifically getting rid of libUV. That is not something that is worth doing if there isn’t much interest in a better graphics engine.

Stephen

et-imac-retina:~ sjbespa$ julia () | A fresh approach to technical computing () | () () | Documentation: http://docs.julialang.org | |_ | Type "?help" for help. | | | | | | |/ ` | | | | || | | | (| | | Version 0.5.0 (2016-09-19 18:14 UTC) / |_'||_|'_| |
|__/ | x86_64-apple-darwin15.6.0

julia> VERSION v"0.5.0"

julia> versioninfo() Julia Version 0.5.0 Commit 3c9d753 (2016-09-19 18:14 UTC) Platform Info: System: Darwin (x86_64-apple-darwin15.6.0) CPU: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz WORD_SIZE: 64 BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NOAFFINITY Haswell) LAPACK: libopenblas64 LIBM: libopenlibm LLVM: libLLVM-3.7.1 (ORCJIT, haswell)

julia> Pkg.status() 16 required packages:

julia>

On Oct 27, 2016, at 12:49 PM, Tamas Nagy notifications@github.com wrote:

Huh. This is really weird. What's your versioninfo()?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

tlnagy commented 8 years ago

I don't think I could dedicate much time to such a project, but it would be cool to have. You can email me at my email address on my github profile. And to be honest, I don't know what is going on here. I agree that it seems spooky, maybe @shashi knows?

protogeezer commented 8 years ago

What I’m asking for is maybe exchanging a dozen or two emails to make sure what I go off and work on is ultimately valuable. I don’t believe that I need much help once I have a clear vision of what I’m setting out to accomplish.

Really, you have brought Gadfly back from the brink. That’s huge! My intent is to build a more capable framework to make it even better.

I’ll do more digging to see if I can narrow down what’s going on wrt PyPlot vs Gadfly.

Stephen

On Oct 28, 2016, at 12:02 PM, Tamas Nagy notifications@github.com wrote:

I don't think I could dedicate much time to such a project, but it would be cool to have. And to be honest, I don't know what is going on here. I agree that it seems spooky, maybe @shashi knows?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

cstjean commented 5 years ago

I'm getting this error on a fresh julia 1.0.2 session

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.0.2 (2018-11-08)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using PyPlot

julia> plot([1,2])
2018-11-25 17:30:28.874 julia[664:9436] -[NSApplication _setup:]: unrecognized selector sent to instance 0x7fac1dca1b00
2018-11-25 17:30:28.882 julia[664:9436] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x7fac1dca1b00'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff3285c23b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x00007fff59adbc76 objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff328f4d94 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   CoreFoundation                      0x00007fff327d2700 ___forwarding___ + 1456
    4   CoreFoundation                      0x00007fff327d20c8 _CF_forwarding_prep_0 + 120
    5   libtk8.6.dylib                      0x0000000135bf731d TkpInit + 413
    6   libtk8.6.dylib                      0x0000000135b4f17e Initialize + 2622
    7   _tkinter.cpython-37m-darwin.so      0x0000000135138a0f _tkinter_create + 1183
    8   libpython3.7m.dylib                 0x0000000123eea2b9 _PyMethodDef_RawFastCallKeywords + 681
    9   libpython3.7m.dylib                 0x0000000123eea3bd _PyCFunction_FastCallKeywords + 45
    10  libpython3.7m.dylib                 0x0000000123ff3c4b call_function + 603
    11  libpython3.7m.dylib                 0x0000000123feae45 _PyEval_EvalFrameDefault + 7893
    12  libpython3.7m.dylib                 0x0000000123fe8ad9 _PyEval_EvalCodeWithName + 3305
    13  libpython3.7m.dylib                 0x0000000123ee91b1 _PyFunction_FastCallDict + 481
    14  libpython3.7m.dylib                 0x0000000123eeaba4 _PyObject_Call_Prepend + 164
    15  libpython3.7m.dylib                 0x0000000123f525aa slot_tp_init + 298
    16  libpython3.7m.dylib                 0x0000000123f5bca7 type_call + 295
    17  libpython3.7m.dylib                 0x0000000123ee9e73 _PyObject_FastCallKeywords + 691
    18  libpython3.7m.dylib                 0x0000000123ff3cb4 call_function + 708
    19  libpython3.7m.dylib                 0x0000000123feaf6c _PyEval_EvalFrameDefault + 8188
    20  libpython3.7m.dylib                 0x0000000123ee9a6e function_code_fastcall + 254
    21  libpython3.7m.dylib                 0x0000000123ff3cbe call_function + 718
    22  libpython3.7m.dylib                 0x0000000123feae45 _PyEval_EvalFrameDefault + 7893
    23  libpython3.7m.dylib                 0x0000000123fe8ad9 _PyEval_EvalCodeWithName + 3305
    24  libpython3.7m.dylib                 0x0000000123ee91b1 _PyFunction_FastCallDict + 481
    25  libpython3.7m.dylib                 0x0000000123eeaba4 _PyObject_Call_Prepend + 164
    26  libpython3.7m.dylib                 0x0000000123eec5b4 method_call + 36
    27  libpython3.7m.dylib                 0x0000000123eea5b6 PyObject_Call + 246
    28  libpython3.7m.dylib                 0x0000000123feb1b5 _PyEval_EvalFrameDefault + 8773
    29  libpython3.7m.dylib                 0x0000000123fe8ad9 _PyEval_EvalCodeWithName + 3305
    30  libpython3.7m.dylib                 0x0000000123ee91b1 _PyFunction_FastCallDict + 481
    31  ???                                 0x000000010bf38aba 0x0 + 4495477434
    32  ???                                 0x000000010bf3e547 0x0 + 4495500615
    33  ???                                 0x000000010bf5c978 0x0 + 4495624568
    34  libjulia.1.0.dylib                  0x0000000106b1aba3 jl_fptr_trampoline + 51
    35  ???                                 0x000000010bf5c886 0x0 + 4495624326
    36  libjulia.1.0.dylib                  0x0000000106b2b592 jl_f__apply + 1218
    37  libjulia.1.0.dylib                  0x0000000106b2ba2f jl_f__apply_latest + 63
    38  ???                                 0x000000010bf5c455 0x0 + 4495623253
    39  ???                                 0x000000010bf5a25e 0x0 + 4495614558
    40  ???                                 0x000000010bf5a384 0x0 + 4495614852
    41  ???                                 0x000000010bf59c77 0x0 + 4495613047
    42  ???                                 0x000000010bf07b8c 0x0 + 4495276940
)
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: 23709184 (Pool: 23704428; Big: 4756); GC: 52

[Process completed]

julia> versioninfo()
Julia Version 1.0.2
Commit d789231e99 (2018-11-08 20:11 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin14.5.0)
  CPU: Intel(R) Core(TM) i7-4650U CPU @ 1.70GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, haswell)
tkf commented 5 years ago

@cstjean Probably it's yet another #410 (just by pattern matching TkpInit). It looks like pygui(:qt5) after installing dependencies works.

stevengj commented 5 years ago

Closing as a dup of #410