python - 尝试在 Windows 上构建自定义 julia 系统映像时出错
问题描述
我想构建一个自定义 julia .dll 以加快我从 python 包装器调用的一些自定义 julia 代码的初始化。我按照此页面上的说明操作:https ://pyjulia.readthedocs.io/en/latest/sysimage.html并运行了命令
python -m julia.sysimage sys.dll
但我得到这个错误
Activating new environment at `C:\Users\KENNET~2\AppData\Local\Temp\tmp.pyjulia.sysimage.ns0yrrt6\compiler_env\Project.toml`
[ Info: Installing PackageCompiler...
Updating registry at `C:\Users\kenneth39080\.julia\registries\General`
Resolving package versions...
Updating `C:\Users\kenneth39080\AppData\Local\Temp\tmp.pyjulia.sysimage.ns0yrrt6\compiler_env\Project.toml`
[9b87118b] + PackageCompiler v1.2.4
Updating `C:\Users\kenneth39080\AppData\Local\Temp\tmp.pyjulia.sysimage.ns0yrrt6\compiler_env\Manifest.toml`
[9b87118b] + PackageCompiler v1.2.4
[2a0f44e3] + Base64
[ade2ca70] + Dates
[b77e0a4c] + InteractiveUtils
[76f85450] + LibGit2
[8f399da3] + Libdl
[56ddb016] + Logging
[d6f4376e] + Markdown
[44cfe95a] + Pkg
[de0858da] + Printf
[3fa0cd96] + REPL
[9a3f8284] + Random
[ea8e919c] + SHA
[9e88b42a] + Serialization
[6462fe0b] + Sockets
[cf7118a7] + UUIDs
[4ec0a83e] + Unicode
┌ Error: build.log for PackageCompiler [9b87118b-4619-50d2-8e1e-99f35a4d4d9d] not found
└ @ Main C:\Users\kenneth39080\Miniconda3\Lib\site-packages\julia\install-packagecompiler.jl:19
[ Info: Loading PackageCompiler...
[ Info: PackageCompiler is successfully installed at C:\Users\KENNET~2\AppData\Local\Temp\tmp.pyjulia.sysimage.ns0yrrt6\compiler_env
Activating environment at `C:\Users\KENNET~2\AppData\Local\Temp\tmp.pyjulia.sysimage.ns0yrrt6\compiler_env\Project.toml`
[ Info: Loading PackageCompiler...
[ Info: Installing PyCall...
Activating new environment at `C:\Users\KENNET~2\AppData\Local\Temp\tmp.pyjulia.sysimage.ns0yrrt6\Project.toml`
Updating registry at `C:\Users\kenneth39080\.julia\registries\General`
Resolving package versions...
Updating `C:\Users\kenneth39080\AppData\Local\Temp\tmp.pyjulia.sysimage.ns0yrrt6\Project.toml`
[438e738f] + PyCall v1.92.1
Updating `C:\Users\kenneth39080\AppData\Local\Temp\tmp.pyjulia.sysimage.ns0yrrt6\Manifest.toml`
[8f4d0f93] + Conda v1.5.0
[682c06a0] + JSON v0.21.1
[1914dd2f] + MacroTools v0.5.6
[69de0a69] + Parsers v1.0.15
[438e738f] + PyCall v1.92.1
[81def892] + VersionParsing v1.2.0
[2a0f44e3] + Base64
[ade2ca70] + Dates
[8f399da3] + Libdl
[37e2e46d] + LinearAlgebra
[d6f4376e] + Markdown
[a63ad114] + Mmap
[de0858da] + Printf
[9a3f8284] + Random
[9e88b42a] + Serialization
[4ec0a83e] + Unicode
[ Info: Compiling a temporary system image without `PyCall`...
[ Info: PackageCompiler: creating system image object file, this might take a while...
Traceback (most recent call last):
File "c:\users\kenneth39080\miniconda3\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\kenneth39080\miniconda3\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "c:\users\kenneth39080\miniconda3\Scripts\julia-py.exe\__main__.py", line 7, in <module>
File "c:\users\kenneth39080\miniconda3\lib\site-packages\julia\julia_py.py", line 151, in main
julia_py(**vars(parse_args(args, **kwargs)))
File "c:\users\kenneth39080\miniconda3\lib\site-packages\julia\julia_py.py", line 74, in julia_py
api.jl_atexit_hook(code)
OSError: exception: stack overflow
ERROR: LoadError: failed process: Process(`'c:\users\kenneth39080\miniconda3\Scripts\julia-py.exe' --color=yes --startup-file=no --cpu-target=native '--sysimage=C:\Users\kenneth39080\AppData\Local\Programs\Julia 1.5.3\lib\julia\sys.dll' --project=. '--output-o=C:\Users\KENNET~2\AppData\Local\Temp\jl_1uL7ce65to.o' -e 'Base.reinit_stdio()
@eval Sys BINDIR = ccall(:jl_get_julia_bindir, Any, ())::String
@eval Sys STDLIB = "C:\\Users\\kenneth39080\\AppData\\Local\\Programs\\Julia 1.5.3\\share\\julia\\stdlib\\v1.5"
Base.init_load_path()
if isdefined(Base, :init_active_project)
Base.init_active_project()
end
Base.init_depot_path()
# This @eval prevents symbols from being put into Main
@eval Module() begin
PrecompileStagingArea = Module()
for (_pkgid, _mod) in Base.loaded_modules
if !(_pkgid.name in ("Main", "Core", "Base"))
eval(PrecompileStagingArea, :(const $(Symbol(_mod)) = $_mod))
end
end
precompile_statements = String[]
append!(precompile_statements, readlines("C:\\Users\\KENNET~2\\AppData\\Local\\Temp\\jl_1gGb5xu3ra"))
for statement in sort(precompile_statements)
# println(statement)
# The compiler has problem caching signatures with \`Vararg{?, N}\`. Replacing
# N with a large number seems to work around it.
statement = replace(statement, r"Vararg{(.*?), N} where N" => s"Vararg{\1, 100}")
try
Base.include_string(PrecompileStagingArea, statement)
catch
# See julia issue #28808
@debug "failed to execute $statement"
end
end
end # module
empty!(LOAD_PATH)
empty!(DEPOT_PATH)
'`, ProcessExited(1)) [1]
Stacktrace:
[1] pipeline_error at .\process.jl:525 [inlined]
[2] run(::Cmd; wait::Bool) at .\process.jl:440
[3] run at .\process.jl:438 [inlined]
[4] create_sysimg_object_file(::String, ::Array{String,1}; project::String, base_sysimage::String, precompile_execution_file::Array{String,1}, precompile_statements_file::Array{String,1}, cpu_target::String, script::Nothing, isapp::Bool) at C:\Users\kenneth39080\.julia\packages\PackageCompiler\KeZOk\src\PackageCompiler.jl:307
[5] create_sysimage(::Array{Symbol,1}; sysimage_path::String, project::String, precompile_execution_file::Array{String,1}, precompile_statements_file::Array{String,1}, incremental::Bool, filter_stdlibs::Bool, replace_default::Bool, cpu_target::String, script::Nothing, base_sysimage::Nothing, isapp::Bool) at C:\Users\kenneth39080\.julia\packages\PackageCompiler\KeZOk\src\PackageCompiler.jl:443
[6] (::var"#1#2")(::String) at C:\Users\kenneth39080\Miniconda3\Lib\site-packages\julia\compile.jl:27
[7] mktempdir(::var"#1#2", ::String; prefix::String) at .\file.jl:709
[8] mktempdir(::Function, ::String) at .\file.jl:707 (repeats 2 times)
[9] top-level scope at C:\Users\kenneth39080\Miniconda3\Lib\site-packages\julia\compile.jl:24
[10] include(::Function, ::Module, ::String) at .\Base.jl:380
[11] include(::Module, ::String) at .\Base.jl:368
[12] exec_options(::Base.JLOptions) at .\client.jl:296
[13] _start() at .\client.jl:506
[14] #invokelatest#1 at .\essentials.jl:710 [inlined]
[15] invokelatest(::Any) at .\essentials.jl:709
[16] top-level scope at none:1
in expression starting at C:\Users\kenneth39080\Miniconda3\Lib\site-packages\julia\compile.jl:23
Command '['C:\\Users\\kenneth39080\\Miniconda3\\Scripts\\julia-py.exe', '--julia', 'julia', '--compiled-modules=no', '--color=yes', 'C:\\Users\\kenneth39080\\Miniconda3\\Lib\\site-packages\\julia\\compile.jl', 'C:\\Users\\KENNET~2\\AppData\\Local\\Temp\\tmp.pyjulia.sysimage.ns0yrrt6\\compiler_env', 'C:\\Users\\kenneth39080\\Miniconda3\\Lib\\site-packages\\julia\\precompile.jl', 'C:\\Users\\kenneth39080\\sys.dll', '']' returned non-zero exit status 1.
我注意到文档说自定义系统映像构建命令未在 Windows 上测试,因此可能与它有关。但是我找不到任何其他人有这个确切问题的记录,所以我想知道我是否做错了什么?
解决方案
推荐阅读
- python-3.x - Instance Counting Properly with Sub Classes
- c - 向进程组中除自身以外的所有进程发出信号
- python - sqlalchemy 无法识别我的 mysql 数据库
- gnuradio - osmocom 源和 rtl-sdr 源的区别?
- java - JPA createStoredProcedureQuery 在使用 Hibernate 时抛出“ORA-01000: maximum open cursors exceeded”
- apache-nifi - 以编程方式读取 Nifi Counter 值
- java - 如何在 Java 中读取在线 XML 文件以了解汇率
- vba - VBA将公式添加到包含特定文本的单元格
- python - 如何将当前的 python 程序转换为多处理/多线程
- wpf - 在 2 个不同的网格视图中选择相同的项目