JuliaPy / JuliaPy/PythonCall.jl
Trouble when using a sysimage with PythonCall
- Ngôn ngữ chính
- Julia
- Star
- 1.1k
- Fork
- 86
- Merge trung bình
- 1 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 3
Mô tả
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.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- backend
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 28/100