JuliaPy / JuliaPy/PyPlot.jl

Plots don't show automatically when PyPlot compiled with PackageCompiler

未关闭
#476 9 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Julia
星标
488
派生
90
PR 合并指标
30 天内没有已合并 PR

描述

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,

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

then load it with

```julia
$ 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

# 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)))))
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.

贡献指南

这个仓库没有索引到贡献指南

调研方向

Reproduce the issue with the shown PackageCompiler sysimage command and Julia REPL steps. Start at src/PyPlot.jl:183 and compare the PyCall traceback around show(); done means plots display automatically after using PyPlot and show() closes without the reported signal-handler error.

由索引模型根据 Issue 内容生成。

评估

技术栈
julia, python
领域
data-visualization
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
30/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。