Skip to content

On PythonCall load, UndefRefError: access to undefined reference #765

Open

Description

@mkitti

Affects: PythonCall

Describe the bug

https://github.com/JuliaIO/PyTensorStore.jl/actions/runs/24747323082/job/72507767012?pr=3

ERROR: LoadError: InitError: UndefRefError: access to undefined reference
Stacktrace:
  [1] _pyjl_new(t::Ptr{PythonCall.C.PyObject}, ::Ptr{PythonCall.C.PyObject}, ::Ptr{PythonCall.C.PyObject})
    @ PythonCall.JlWrap.Cjl ~/.julia/packages/PythonCall/83z4q/src/JlWrap/C.jl:24
  [2] PyObject_CallObject
    @ ~/.julia/packages/PythonCall/83z4q/src/C/pointers.jl:300 [inlined]
  [3] PyJuliaValue_New
    @ ~/.julia/packages/PythonCall/83z4q/src/JlWrap/C.jl:392 [inlined]
  [4] macro expansion
    @ ~/.julia/packages/PythonCall/83z4q/src/Core/Py.jl:118 [inlined]
  [5] pyjl(t::PythonCall.Py, v::Module)
    @ PythonCall.JlWrap ~/.julia/packages/PythonCall/83z4q/src/JlWrap/base.jl:7
  [6] pyjl
    @ ~/.julia/packages/PythonCall/83z4q/src/JlWrap/any.jl:400 [inlined]
  [7] Py
    @ ~/.julia/packages/PythonCall/83z4q/src/JlWrap/base.jl:141 [inlined]
  [8] macro expansion
    @ ~/.julia/packages/PythonCall/83z4q/src/Core/Py.jl:117 [inlined]
  [9] pysetattr
    @ ~/.julia/packages/PythonCall/83z4q/src/Core/builtins.jl:78 [inlined]
 [10] setproperty!(x::PythonCall.Py, k::Symbol, v::Module)
    @ PythonCall.Core ~/.julia/packages/PythonCall/83z4q/src/Core/Py.jl:281
 [11] __init__()
    @ PythonCall.JlWrap ~/.julia/packages/PythonCall/83z4q/src/JlWrap/JlWrap.jl:70
 [12] run_module_init(mod::Module, i::Int64)
    @ Base ./loading.jl:1445
 [13] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1433
 [14] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any}; register::Bool)
    @ Base ./loading.jl:1321
 [15] _include_from_serialized
    @ ./loading.jl:1276 [inlined]
 [16] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128, stalecheck::Bool; reasons::Dict{String, Int64}, DEPOT_PATH::Vector{String})
    @ Base ./loading.jl:2117
 [17] _require_search_from_serialized
    @ ./loading.jl:2011 [inlined]
 [18] __require_prelocked(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:2629
 [19] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:2495
 [20] macro expansion
    @ ./loading.jl:2423 [inlined]
 [21] macro expansion
    @ ./lock.jl:376 [inlined]
 [22] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:2388
 [23] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:2364
 [24] top-level scope
    @ ~/work/PyTensorStore.jl/PyTensorStore.jl/src/PyTensorStore.jl:3
 [25] include(mod::Module, _path::String)
    @ Base ./Base.jl:306
 [26] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
    @ Base ./loading.jl:3028
 [27] top-level scope
    @ stdin:5
 [28] eval(m::Module, e::Any)
    @ Core ./boot.jl:489
 [29] include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String)
    @ Base ./loading.jl:2874
 [30] include_string
    @ ./loading.jl:2884 [inlined]
 [31] exec_options(opts::Base.JLOptions)
    @ Base ./client.jl:315
 [32] _start()
    @ Base ./client.jl:550
during initialization of module JlWrap
in expression starting at /home/runner/work/PyTensorStore.jl/PyTensorStore.jl/src/PyTensorStore.jl:1

Your system
Please provide detailed information about your system:

Ubuntu Linux (Github Linux runner)
Julia 1.12.6
Python 3.14.4
PythonCall v0.9.31

Additional context
Add any other context about the problem here.

Activity

  1. mkitti commented on Apr 22, 2026

    @mkitti
    MemberAuthor
    julia> CondaPkg.status()
    CondaPkg Status /groups/scicompsoft/home/kittisopikulm/src/PyTensorStore.jl/CondaPkg.toml
    Environment
      /groups/scicompsoft/home/kittisopikulm/src/PyTensorStore.jl/.CondaPkg/.pixi/envs/default
    Packages
      tensorstore v0.1.82
    
    julia> versioninfo()
    Julia Version 1.12.6
    Commit 15346901f00 (2026-04-09 19:20 UTC)
    Build Info:
      Official https://julialang.org release
    Platform Info:
      OS: Linux (x86_64-linux-gnu)
      CPU: 96 × Intel(R) Xeon(R) Gold 6248R CPU @ 3.00GHz
      WORD_SIZE: 64
      LLVM: libLLVM-18.1.7 (ORCJIT, cascadelake)
      GC: Built with stock GC
    Threads: 1 default, 1 interactive, 1 GC (on 96 virtual cores)
    Environment:
      LD_LIBRARY_PATH = /misc/lsf/10.1/linux3.10-glibc2.17-x86_64/lib
    
  2. mkitti commented on Apr 22, 2026

    @mkitti
    MemberAuthor
    julia> pyjl(Base.Core)
    ERROR: UndefRefError: access to undefined reference
    Stacktrace:
     [1] _pyjl_new(t::Ptr{PythonCall.C.PyObject}, ::Ptr{PythonCall.C.PyObject}, ::Ptr{PythonCall.C.PyObject})
       @ PythonCall.JlWrap.Cjl ~/.julia/packages/PythonCall/83z4q/src/JlWrap/C.jl:24
     [2] PyObject_CallObject
       @ ~/.julia/packages/PythonCall/83z4q/src/C/pointers.jl:300 [inlined]
     [3] PyJuliaValue_New
       @ ~/.julia/packages/PythonCall/83z4q/src/JlWrap/C.jl:392 [inlined]
     [4] macro expansion
       @ ~/.julia/packages/PythonCall/83z4q/src/Core/Py.jl:118 [inlined]
     [5] pyjl(t::Py, v::Module)
       @ PythonCall.JlWrap ~/.julia/packages/PythonCall/83z4q/src/JlWrap/base.jl:7
     [6] pyjl(v::Module)
       @ PythonCall.JlWrap ~/.julia/packages/PythonCall/83z4q/src/JlWrap/any.jl:400
     [7] top-level scope
       @ REPL[35]:1
    
    
  3. mkitti commented on Apr 22, 2026

    @mkitti
    MemberAuthor
    julia> t = pyjltype(Base.Core)
    Python: <class 'juliacall.ModuleValue'>
    
    julia> v = Base.Core
    Core
    
    julia> PythonCall.JlWrap.Cjl.PyJuliaValue_New(t, v)
    ERROR: UndefRefError: access to undefined reference
    Stacktrace:
     [1] _pyjl_new(t::Ptr{PythonCall.C.PyObject}, ::Ptr{PythonCall.C.PyObject}, ::Ptr{PythonCall.C.PyObject})
       @ PythonCall.JlWrap.Cjl ~/.julia/packages/PythonCall/83z4q/src/JlWrap/C.jl:24
     [2] PyObject_CallObject
       @ ~/.julia/packages/PythonCall/83z4q/src/C/pointers.jl:300 [inlined]
     [3] PyJuliaValue_New(_t::Py, v::Any)
       @ PythonCall.JlWrap.Cjl ~/.julia/packages/PythonCall/83z4q/src/JlWrap/C.jl:392
     [4] top-level scope
       @ REPL[65]:1
    
  4. mkitti commented on Apr 22, 2026

    @mkitti
    MemberAuthor

    I isolated it to _pyjl_new. This appears fixed on @MilesCranmer 's #746 and master.

    julia> using PythonCall
    ERROR: InitError: UndefRefError: access to undefined reference
    ...
    during initialization of module JlWrap
    
    julia> using PythonCall
    
    julia> ccall(PythonCall.C.POINTERS.PyObject_CallObject, Ptr{PythonCall.C.PyObject}, (Ptr{PythonCall.C.PyObject}, Ptr{PythonCall.C.PyObject}), PythonCall.C.asptr(PythonCall.pyjltype(Base.Core)), PythonCall.C.PyNULL)
    ERROR: UndefRefError: access to undefined reference
    Stacktrace:
     [1] _pyjl_new(t::Ptr{PythonCall.C.PyObject}, ::Ptr{PythonCall.C.PyObject}, ::Ptr{PythonCall.C.PyObject})
       @ PythonCall.JlWrap.Cjl ~/.julia/packages/PythonCall/83z4q/src/JlWrap/C.jl:24
     [2] top-level scope
       @ ./REPL[2]:1

    I propose that we release soon.

  5. mkitti commented on Apr 22, 2026

    @mkitti
    MemberAuthor

    Switching to main at 8f7baa5 resolves this for me.

    using Pkg
    Pkg.add(url="https://github.com/JuliaPy/PythonCall.jl")
    
  6. cjdoris commented on May 14, 2026

    @cjdoris
    Member

    I've just made a release (0.9.32) - please try it out and close this issue if fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions