-
-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to compile PyPlot #226
Comments
You may want to raise this on www.github.com/JuliaPy/PyCall.jl as well... |
Sure, I will try asking there. |
I wonder what is in |
The workaround helped but then I got the following error. By looking at #148 this seems to be related to global variables. After taking care of all global variables as suggested in #148 (I thought I did) in PyPlot.jl I still got the same error. Any ideas? Thanks. fatal: error thrown and no exception handler available.
ErrorException("Task cannot be serialized")
rec_backtrace at /home/Administrator/buildbot/worker/package_win64/build/src\stackwalk.c:94
record_backtrace at /home/Administrator/buildbot/worker/package_win64/build/src\task.c:217 [inlined]
jl_throw at /home/Administrator/buildbot/worker/package_win64/build/src\task.c:417
jl_error at /home/Administrator/buildbot/worker/package_win64/build/src\rtutils.c:41
jl_serialize_value_ at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:294
jl_serialize_value_ at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:252 [inlined]
jl_serialize_value_ at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:286
jl_serialize_value_ at /home/Administrator/buildbot/worker/package_win64/build/src\julia.h:915 [inlined]
jl_serialize_value_ at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:303
jl_serialize_value_ at /home/Administrator/buildbot/worker/package_win64/build/src\julia.h:915 [inlined]
jl_serialize_value_ at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:303
jl_serialize_value_ at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:252 [inlined]
jl_serialize_value_ at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:286
jl_serialize_value_ at /home/Administrator/buildbot/worker/package_win64/build/src\julia.h:915 [inlined]
jl_serialize_value_ at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:303
jl_serialize_value_ at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:252 [inlined]
jl_serialize_module at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:230 [inlined]
jl_serialize_value_ at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:291
jl_serialize_value_ at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:252 [inlined]
jl_serialize_module at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:232 [inlined]
jl_serialize_value_ at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:291
jl_serialize_value_ at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:252 [inlined]
jl_serialize_module at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:230 [inlined]
jl_serialize_value_ at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:291
jl_serialize_module at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:222 [inlined]
jl_serialize_value_ at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:291
jl_serialize_value_ at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:337 [inlined]
jl_save_system_image_to_stream at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:1273
jl_create_system_image at /home/Administrator/buildbot/worker/package_win64/build/src\staticdata.c:1378
jl_write_compiler_output at /home/Administrator/buildbot/worker/package_win64/build/src\precompile.c:76
jl_atexit_hook at /home/Administrator/buildbot/worker/package_win64/build/src/home/Administrator/buildbot/worker/package_win64/build/src\init.c:222
wmain at /home/Administrator/buildbot/worker/package_win64/build/ui\repl.c:218
__tmainCRTStartup at /usr/src/debug/mingw64-x86_64-runtime-5.0.3-1/crt\crtexe.c:329
mainCRTStartup at /usr/src/debug/mingw64-x86_64-runtime-5.0.3-1/crt\crtexe.c:212
BaseThreadInitThunk at C:\WINDOWS\System32\KERNEL32.DLL (unknown line)
RtlUserThreadStart at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
ERROR: failed process: Process(`'C:\Users\bliang26\AppData\Local\Julia-1.1.0\bin\julia.exe' '--sysimage=C:\Users\bliang26\.julia\dev\PackageCompiler\sysimg\backup\native\sys.dll' --output-o=sys.a --track-allocation=none --code-coverage=none --history-file=yes --inline=yes --math-mode=ieee --compile=yes --track-allocation=none --sysimage-native-code=yes '--sysimage=C:\Users\bliang26\AppData\Local\Julia-1.1.0\lib\julia\sys.dll' --compiled-modules=yes --optimize=2 'C:\Users\bliang26\.julia\dev\PackageCompiler\sysimg\run_julia_code.jl'`, ProcessExited(1)) [1]
Stacktrace:
[1] error(::String, ::Base.Process, ::String, ::Int64, ::String) at .\error.jl:42
[2] pipeline_error at .\process.jl:785 [inlined]
[3] #run#515(::Bool, ::Function, ::Cmd) at .\process.jl:726
[4] run at .\process.jl:724 [inlined]
[5] #run_julia#1 at C:\Users\bliang26\.julia\dev\PackageCompiler\src\compiler_flags.jl:225 [inlined]
[6] #run_julia at .\none:0 [inlined]
[7] (::getfield(PackageCompiler, Symbol("##13#14")){Base.Iterators.Pairs{Symbol,Any,NTuple{14,Symbol},NamedTuple{(:sysimage, :startup_file, :handle_signals, :sysimage_native_code, :compiled_modules, :depwarn, :warn_overwrite, :compile, :cpu_target, :optimize, :debug_level, :inline, :check_bounds, :math_mode),Tuple{String,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}}},String})() at C:\Users\bliang26\.julia\dev\PackageCompiler\src\static_julia.jl:262
[8] cd(::getfield(PackageCompiler, Symbol("##13#14")){Base.Iterators.Pairs{Symbol,Any,NTuple{14,Symbol},NamedTuple{(:sysimage, :startup_file, :handle_signals, :sysimage_native_code, :compiled_modules, :depwarn, :warn_overwrite, :compile, :cpu_target, :optimize, :debug_level, :inline, :check_bounds, :math_mode),Tuple{String,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}}},String}, ::String) at .\file.jl:85
[9] #build_object#12(::Base.Iterators.Pairs{Symbol,Any,NTuple{14,Symbol},NamedTuple{(:sysimage, :startup_file, :handle_signals, :sysimage_native_code, :compiled_modules, :depwarn, :warn_overwrite, :compile, :cpu_target, :optimize, :debug_level, :inline, :check_bounds, :math_mode),Tuple{String,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}}}, ::Function, ::String, ::String, ::String, ::Bool) at C:\Users\bliang26\.julia\dev\PackageCompiler\src\static_julia.jl:261
[10] #build_object at .\none:0 [inlined]
[11] build_object(::String, ::String, ::String, ::Bool, ::String, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing) at C:\Users\bliang26\.julia\dev\PackageCompiler\src\static_julia.jl:240
[12] #static_julia#5(::Nothing, ::Bool, ::Bool, ::String, ::String, ::Nothing, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Nothing, ::Bool, ::Bool, ::String, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::typeof(static_julia), ::String) at C:\Users\bliang26\.julia\dev\PackageCompiler\src\static_julia.jl:161
[13] #static_julia at .\none:0 [inlined]
[14] #build_sysimg#29(::Bool, ::Bool, ::Bool, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::typeof(PackageCompiler.build_sysimg), ::String, ::String) at C:\Users\bliang26\.julia\dev\PackageCompiler\src\api.jl:25
[15] #build_sysimg at .\none:0 [inlined]
[16] #compile_package#67(::Bool, ::Bool, ::Bool, ::Nothing, ::Bool, ::Function, ::Tuple{String,String}, ::Vararg{Tuple{String,String},N} where N) at C:\Users\bliang26\.julia\dev\PackageCompiler\src\PackageCompiler.jl:130
[17] (::getfield(PackageCompiler, Symbol("#kw##compile_package")))(::NamedTuple{(:force, :reuse),Tuple{Bool,Bool}}, ::typeof(compile_package), ::Tuple{String,String}, ::Vararg{Tuple{String,String},N} where N) at .\none:0
[18] #compile_package#64(::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol,Symbol},NamedTuple{(:force, :reuse),Tuple{Bool,Bool}}}, ::Function, ::String, ::Vararg{String,N} where N) at C:\Users\bliang26\.julia\dev\PackageCompiler\src\PackageCompiler.jl:94
[19] (::getfield(PackageCompiler, Symbol("#kw##compile_package")))(::NamedTuple{(:force, :reuse),Tuple{Bool,Bool}}, ::typeof(compile_package), ::String, ::Vararg{String,N} where N) at .\none:0
[20] top-level scope at none:0 |
Hmm... I guess it's something to do with the GUI event loop in PyCall (although I think we are stopping the event loop via |
It looks like you can workaround this by I checked it with the following changes in PyCall: $ git diff master
diff --git a/aot/compile.jl b/aot/compile.jl
index 63d0cb7..a71415d 100755
--- a/aot/compile.jl
+++ b/aot/compile.jl
@@ -9,6 +9,7 @@ Pkg.activate(@__DIR__)
Pkg.add("MacroTools")
Pkg.develop(PackageSpec(name="PyCall", path=dirname(@__DIR__)))
Pkg.build("PyCall")
+Pkg.add("PyPlot")
Pkg.activate()
using PackageCompiler
diff --git a/aot/precompile.jl b/aot/precompile.jl
index cb63b73..4ba69e3 100644
--- a/aot/precompile.jl
+++ b/aot/precompile.jl
@@ -14,3 +14,6 @@ isdefined(MacroTools, :__init__) && MacroTools.__init__()
using PyCall
PyCall.__init__()
PyCall.pyimport("sys")[:executable]
+
+using PyPlot
+PyPlot.__init__()
$ MPLBACKEND=agg aot/compile.jl --color=yes
...
[ Info: System image: /home/takafumi/.julia/dev/PyCall/aot/sys.so So, this part seems to be an issue in PyCall and/or PyPlot. |
Awesome! How did you find out? The error message didn't show any clue. This definitely works, but the problem is that no figure shows up as I plot since the agg backend is for non-interactive use. If I switch to other interactive backends such as qt5agg I still got the same error message. Could you let me know how did you debug it so that maybe I can give it a try. Thanks. |
I thought
I observe this too. The strange thing is that both matplotlib and PyPlot.jl report that they have the correct GUI backend. Also, re-starting the GUI with
fixes the problem. I haven't figured out what is going on.
At this point I think you need to debug |
It is working for me, just add |
I was trying to compile PyPlot with
but got the following error message:
PyCall was set up by the Conda.jl package. And here's my version info:
The text was updated successfully, but these errors were encountered: