Skip to content

Can't use PythonCall in Custom System Image #600

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

Open
BenCurran98 opened this issue Apr 1, 2025 · 0 comments
Open

Can't use PythonCall in Custom System Image #600

BenCurran98 opened this issue Apr 1, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@BenCurran98
Copy link

Affects: PythonCall

Describe the bug
I'm trying to build a Julia system image that uses PythonCall.jl. I can build the system image, but when I try to launch Julia with it it crashes on initialisation.

As a MWE, I've set up a package here that just uses PythonCall.jl. You can then run the following code to create a system image with this package:

using Pkg
Pkg.add(url = "https://github.com/BenCurran98/CondaIssue.jl")
Pkg.add("PackageCompiler.jl")
using PackageCompiler
create_sysimage(["CondaIssue"]; sysimage_path = "CondaSysImage.so")

This builds successfully, but when I run it I get the following error:

julia -JCondaSysImage.so --project=.
    CondaPkg Found dependencies: /home/ben/.julia/packages/PythonCall/WMWY0/CondaPkg.toml
fatal: error thrown and no exception handler available.
InitError(mod=:C, error=MethodError(f=Base.Cmd, args=(Array{Nothing, 1}(dims=(1,), mem=Memory{Nothing}(1, 0x7183379f3380)[nothing]),), world=0x0000000000006869))
jl_method_error_bare at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/gf.c:2254
jl_method_error at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/gf.c:2272
jl_lookup_generic_ at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/gf.c:3106 [inlined]
ijl_apply_generic at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/gf.c:3121
jl_apply at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/julia.h:2157 [inlined]
do_call at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/interpreter.c:126
eval_value at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/interpreter.c:223
eval_stmt_value at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/interpreter.c:174 [inlined]
eval_body at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/interpreter.c:670
jl_fptr_interpret_call at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/interpreter.c:760
#pixi#4 at /home/ben/.julia/packages/JLLWrappers/GfYNv/src/products/executable_generators.jl:81
jl_apply at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/julia.h:2157 [inlined]
do_call at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/interpreter.c:126
eval_value at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/interpreter.c:223
eval_stmt_value at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/interpreter.c:174 [inlined]
eval_body at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/interpreter.c:670
jl_fptr_interpret_call at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/interpreter.c:760
pixi at /home/ben/.julia/packages/JLLWrappers/GfYNv/src/products/executable_generators.jl:72
jl_apply at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/julia.h:2157 [inlined]
jl_f__call_latest at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/builtins.c:875
#invokelatest#2 at ./essentials.jl:1055 [inlined]
invokelatest at ./essentials.jl:1052
unknown function (ip: 0x71833b906212)
#pixi_cmd#7 at /home/ben/.julia/packages/CondaPkg/pEObH/src/backend.jl:96
pixi_cmd at /home/ben/.julia/packages/CondaPkg/pEObH/src/backend.jl:93
#70 at /home/ben/.julia/packages/CondaPkg/pEObH/src/resolve.jl:916
cd at ./file.jl:112
unknown function (ip: 0x71833b97ccd6)
#resolve#64 at /home/ben/.julia/packages/CondaPkg/pEObH/src/resolve.jl:904
resolve at /home/ben/.julia/packages/CondaPkg/pEObH/src/resolve.jl:682
envdir at /home/ben/.julia/packages/CondaPkg/pEObH/src/env.jl:70
init_context at /home/ben/.julia/packages/PythonCall/WMWY0/src/C/context.jl:63
unknown function (ip: 0x71833b902cbf)
tojlinvoke103745 at /home/ben/Testing/Julia/CondaSysImage.so (unknown line)
j_init_context_102425 at /home/ben/Testing/Julia/CondaSysImage.so (unknown line)
__init__ at /home/ben/.julia/packages/PythonCall/WMWY0/src/C/C.jl:23
jfptr___init___102423 at /home/ben/Testing/Julia/CondaSysImage.so (unknown line)
jl_apply at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/julia.h:2157 [inlined]
jl_module_run_initializer at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/toplevel.c:76
_finish_julia_init at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/init.c:902
julia_init at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/init.c:843
jl_repl_entrypoint at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/src/jlapi.c:1053
main at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-11/cli/loader_exe.c:58
unknown function (ip: 0x71834382a1c9)
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x4010b8)

I've seen similar issues with system images posted here, but they seem more related to the python path rather than this error which I can't identify the cause of. I would appreciate any help you can offer! Thanks :)

Your system

  • Operating system: Ubuntu 24.04
  • Julia version: 1.11.4
  • PythonCall version: 0.9.24
julia> versioninfo()
Julia Version 1.11.4
Commit 8561cc3d68d (2025-03-10 11:36 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 28 × 13th Gen Intel(R) Core(TM) i7-13850HX
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, alderlake)
Threads: 16 default, 0 interactive, 8 GC (on 28 virtual cores)

julia> Pkg.status()
Project CondaIssue v0.1.0
Status `~/Testing/Julia/CondaIssue.jl/Project.toml`
  [6099a3de] PythonCall v0.9.24

julia> CondaPkg.status()
CondaPkg Status /home/ben/Testing/Julia/CondaIssue.jl/CondaPkg.toml
Environment
  /home/ben/Testing/Julia/CondaIssue.jl/.CondaPkg/.pixi/envs/default
Packages
  numpy v2.1.0
@BenCurran98 BenCurran98 added the bug Something isn't working label Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant