JuliaPy / JuliaPy/PythonCall.jl
Trouble when using a sysimage with PythonCall
- 主要言語
- Julia
- スター
- 1.1k
- フォーク
- 86
- 平均マージ
- 1日 22時間
- マージ済み PR(30日)
- 3
説明
I'm having trouble when building a sysimage with PythonCall-- or rather, I can built it OK, but then when I use it, like
```julia
julia --project=myproject --sysimage=mysysimage.so -e "using Pkg; Pkg.instantiate()"
```
I get
```julia
#29 92.79 fatal: error thrown and no exception handler available.
#29 92.79 InitError(mod=:C, error=ErrorException("no environment in the LOAD_PATH depends on CondaPkg"))
#29 92.84 error at ./error.jl:33
#29 92.84 _jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
#29 92.84 jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
#29 92.84 _resolve_top_env at /root/.julia/packages/CondaPkg/GoPlj/src/resolve.jl:16
#29 92.84 _jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
#29 92.84 jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
#29 92.84 #resolve#17 at /root/.julia/packages/CondaPkg/GoPlj/src/resolve.jl:222
#29 92.84 _jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
#29 92.84 jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
#29 92.84 resolve at /root/.julia/packages/CondaPkg/GoPlj/src/resolve.jl:209
#29 92.84 _jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
#29 92.84 jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
#29 92.84 envdir at /root/.julia/packages/CondaPkg/GoPlj/src/env.jl:66
#29 92.85 init_context at /root/.julia/packages/PythonCall/Z6DIG/src/cpython/context.jl:56
#29 92.86 __init__ at /root/.julia/packages/PythonCall/Z6DIG/src/cpython/CPython.jl:21
#29 92.87 jfptr___init___72494 at /deps.so (unknown line)
#29 92.87 _jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
#29 92.87 jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
#29 92.87 jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
#29 92.87 jl_module_run_initializer at /buildworker/worker/package_linux64/build/src/toplevel.c:73
#29 92.87 _finish_julia_init at /buildworker/worker/package_linux64/build/src/init.c:796
#29 92.87 julia_init at /buildworker/worker/package_linux64/build/src/init.c:730
#29 92.87 jl_repl_entrypoint at /buildworker/worker/package_linux64/build/src/jlapi.c:695
#29 92.87 main at /buildworker/worker/package_linux64/build/cli/loader_exe.c:42
#29 92.88 __libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
#29 92.88 _start at /usr/local/julia/bin/julia (unknown line)
#29 93.11 ERROR: Failed to precompile MyPackage [...redacted...]
#29 94.21 Stacktrace:
#29 94.21 [1] error(s::String)
#29 94.60 @ Base ./error.jl:33
#29 94.77 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
#29 94.77 @ Base ./loading.jl:1466
#29 94.77 [3] compilecache(pkg::Base.PkgId, path::String)
#29 94.78 @ Base ./loading.jl:1410
#29 94.78 [4] _require(pkg::Base.PkgId)
#29 94.78 @ Base ./loading.jl:1120
#29 94.78 [5] require(uuidkey::Base.PkgId)
#29 94.78 @ Base ./loading.jl:1013
#29 94.78 [6] require(into::Module, mod::Symbol)
#29 94.78 @ Base ./loading.jl:997
```
(please excuse the `#29 92.79` stuff, I'm in a dockerfile here).
I believe the issue is that PythonCall's `__init__` tries to resolve the CondaPkg environment, but when a module is in a sysimage, that `__init__` occurs at startup time (i.e. when julia itself is starting up), and at that point in the process the package environment isn't setup yet... or something like that.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Reproduce the reported Julia command with a PythonCall sysimage and inspect the PythonCall __init__ path, especially cpython/context.jl, alongside CondaPkg's environment resolution shown in the trace. Determine how startup-time initialization interacts with the project environment; done means the sysimage command can instantiate MyPackage without the fatal CondaPkg error.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- backend
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 28/100