Skip to content

Plots don't show automatically when PyPlot compiled with PackageCompiler #476

Open
@marius311

Description

@marius311

Not sure if this is supposed to work (in any case it seems like its really close to working). I compiled PyPlot v2.8.2 with PackageCompiler v1.1.0 on julia 1.4,

create_sysimage([:PyPlot], sysimage_path="pyplot.so")

then load it with

$ julia -J pyplot.so 

julia> using PyPlot

# no plot gets shown shown here (but there should be)
julia> plot([1,2,3])  
1-element Array{PyCall.PyObject,1}:
 PyObject <matplotlib.lines.Line2D object at 0x7f71cca43d68>

# this shows the plot, but the following error pops up after closing the window
julia> show() 
ERROR: PyError ($(Expr(:escape, :(ccall(#= /home/marius/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'TypeError'>
TypeError('signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object')
  File "/home/marius/miniconda3/lib/python3.7/site-packages/matplotlib/pyplot.py", line 269, in show
    return _show(*args, **kw)
  File "/home/marius/miniconda3/lib/python3.7/site-packages/matplotlib/cbook/deprecation.py", line 413, in wrapper
    return func(*args, **kwargs)
  File "/home/marius/miniconda3/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 3302, in show
    cls.mainloop()
  File "/home/marius/miniconda3/lib/python3.7/site-packages/matplotlib/backends/backend_qt5.py", line 1099, in mainloop
    signal.signal(signal.SIGINT, old_signal)
  File "/home/marius/miniconda3/lib/python3.7/signal.py", line 47, in signal
    handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))

Stacktrace:
 [1] pyerr_check at /home/marius/.julia/packages/PyCall/zqDXB/src/exception.jl:60 [inlined]
 [2] pyerr_check at /home/marius/.julia/packages/PyCall/zqDXB/src/exception.jl:64 [inlined]
 [3] _handle_error(::String) at /home/marius/.julia/packages/PyCall/zqDXB/src/exception.jl:81
 [4] macro expansion at /home/marius/.julia/packages/PyCall/zqDXB/src/exception.jl:95 [inlined]
 [5] #110 at /home/marius/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:43 [inlined]
 [6] disable_sigint at ./c.jl:446 [inlined]
 [7] __pycall! at /home/marius/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:42 [inlined]
 [8] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{}, ::Int64, ::Ptr{Nothing}) at /home/marius/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:29
 [9] _pycall! at /home/marius/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:11 [inlined]
 [10] #pycall#115 at /home/marius/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:80 [inlined]
 [11] pycall at /home/marius/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:80 [inlined]
 [12] #show#148 at /home/marius/.julia/packages/PyPlot/4wzW1/src/PyPlot.jl:183 [inlined]
 [13] show() at /home/marius/.julia/packages/PyPlot/4wzW1/src/PyPlot.jl:183
 [14] top-level scope at REPL[3]:1

Any ideas if this can work and if so how? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions