Python: TypeError: cannot pickle 'PyCapsule' object core.py:432
Python stacktrace: none
Stacktrace:
[1] pythrow()
@ PythonCall ~/.julia/packages/PythonCall/wXfah/src/err.jl:94
[2] errcheck
@ ~/.julia/packages/PythonCall/wXfah/src/err.jl:10 [inlined]
[3] pycallargs
@ ~/.julia/packages/PythonCall/wXfah/src/abstract/object.jl:210 [inlined]
[4] pycall(f::Py, args::Py; kwargs::@Kwargs{})
@ PythonCall ~/.julia/packages/PythonCall/wXfah/src/abstract/object.jl:228
[5] pycall
@ ~/.julia/packages/PythonCall/wXfah/src/abstract/object.jl:218 [inlined]
[6] Py
@ ~/.julia/packages/PythonCall/wXfah/src/Py.jl:341 [inlined]
[7] serialize_py(s::Distributed.ClusterSerializer{Sockets.TCPSocket}, x::Py)
@ PythonCall
~/.julia/packages/PythonCall/wXfah/src/compat/serialization.jl:9
[8] serialize(s::Distributed.ClusterSerializer{Sockets.TCPSocket}, x::Py)
@ PythonCall
~/.julia/packages/PythonCall/wXfah/src/compat/serialization.jl:25
[9] serialize_any(s::Distributed.ClusterSerializer{Sockets.TCPSocket}, x::Any)
@ Serialization
~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Serializa
tion/src/Serialization.jl:676
[10] serialize(s::Distributed.ClusterSerializer{Sockets.TCPSocket}, x::Any)
@ Serialization
~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Serializa
tion/src/Serialization.jl:655
[11] serialize_any(s::Distributed.ClusterSerializer{Sockets.TCPSocket}, x::Any)
@ Serialization
~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Serializa
tion/src/Serialization.jl:676
[12] serialize(s::Distributed.ClusterSerializer{Sockets.TCPSocket}, x::Any)
@ Serialization
~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Serializa
tion/src/Serialization.jl:655
[13] serialize_msg(s::Distributed.ClusterSerializer{Sockets.TCPSocket},
o::Distributed.CallMsg{:call_fetch})
@ Distributed
~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Distribut
ed/src/messages.jl:78
[14] #invokelatest#2
@ ./essentials.jl:887 [inlined]
[15] invokelatest
@ ./essentials.jl:884 [inlined]
[16] send_msg_(w::Distributed.Worker, header::Distributed.MsgHeader,
msg::Distributed.CallMsg{:call_fetch}, now::Bool)
@ Distributed
~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Distribut
ed/src/messages.jl:181
[17] send_msg
@
~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Distribut
ed/src/messages.jl:122 [inlined]
[18] remotecall_fetch(f::Function, w::Distributed.Worker, args::Int64;
kwargs::@Kwargs{})
@ Distributed
~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Distribut
ed/src/remotecall.jl:460
[19] remotecall_fetch(f::Function, w::Distributed.Worker, args::Int64)
@ Distributed
~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Distribut
ed/src/remotecall.jl:454
[20] remotecall_fetch(f::Function, id::Int64, args::Int64)
@ Distributed
~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Distribut
ed/src/remotecall.jl:492
[21] remotecall_pool(rc_f::Function, f::Function, pool::Distributed.WorkerPool,
args::Int64; kwargs::@Kwargs{})
@ Distributed
~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Distribut
ed/src/workerpool.jl:126
[22] remotecall_pool
@ Distributed
~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Distribut
ed/src/workerpool.jl:123 [inlined]
[23] remotecall_fetch
@ Distributed
~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Distribut
ed/src/workerpool.jl:232 [inlined]
[24] #208
@ Distributed
~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Distribut
ed/src/workerpool.jl:288 [inlined]
[25]
(::Base.var"#1023#1028"{Distributed.var"#208#210"{Distributed.var"#208#209#211"{
Distributed.WorkerPool, EquivalentCircuits.var"#177#178"{Int64, Int64, String,
Int64, Float64, Nothing, Float64, Nothing, PyArray{ComplexF64, 1, true, true,
ComplexF64}, PyArray{Float64, 1, true, true,
Float64}}}}})(r::Base.RefValue{Any}, args::Tuple{Int64})
@ Base ./asyncmap.jl:94
[26]
(::Base.var"#1039#1040"{Base.var"#1023#1028"{Distributed.var"#208#210"{Distribut
ed.var"#208#209#211"{Distributed.WorkerPool,
EquivalentCircuits.var"#177#178"{Int64, Int64, String, Int64, Float64, Nothing,
Float64, Nothing, PyArray{ComplexF64, 1, true, true, ComplexF64},
PyArray{Float64, 1, true, true, Float64}}}}}, Channel{Any}, Nothing})()
@ Base ./asyncmap.jl:228
Stacktrace:
[1] (::Base.var"#1033#1035")(x::Task)
@ Base ./asyncmap.jl:171
[2] foreach(f::Base.var"#1033#1035", itr::Vector{Any})
@ Base ./abstractarray.jl:3094
[3] maptwice(wrapped_f::Function, chnl::Channel{Any},
worker_tasks::Vector{Any}, c::UnitRange{Int64})
@ Base ./asyncmap.jl:171
[4] wrap_n_exec_twice
@ ./asyncmap.jl:147 [inlined]
[5] #async_usemap#1018
@ ./asyncmap.jl:97 [inlined]
[6] kwcall(::NamedTuple, ::typeof(Base.async_usemap), f::Any, c::Vararg{Any})
@ Base ./asyncmap.jl:78 [inlined]
[7] #asyncmap#1017
@ ./asyncmap.jl:75 [inlined]
[8] asyncmap
@ ./asyncmap.jl:74 [inlined]
[9] pmap(f::Function, p::Distributed.WorkerPool, c::UnitRange{Int64};
distributed::Bool, batch_size::Int64, on_error::Nothing,
retry_delays::Vector{Any}, retry_check::Nothing)
@ Distributed
~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Distribut
ed/src/pmap.jl:126
[10] pmap
@
~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Distribut
ed/src/pmap.jl:99 [inlined]
[11] circuit_evolution_batch(measurements::PyArray{ComplexF64, 1, true, true,
ComplexF64}, frequencies::PyArray{Float64, 1, true, true, Float64};
generations::Int64, population_size::Int64, terminals::String, head::Int64,
cutoff::Float64, initial_population::Nothing, convergence_threshold::Float64,
bounds::Nothing, numprocs::Int64, iters::Int64, quiet::Bool)
@ EquivalentCircuits
~/Code/EquivalentCircuits.jl/src/CircuitEvolution.jl:381
[12] pyjlany_call(self::typeof(circuit_evolution_batch), args_::Py,
kwargs_::Py)
@ PythonCall ~/.julia/packages/PythonCall/wXfah/src/jlwrap/any.jl:34
[13] _pyjl_callmethod(f::Any, self_::Ptr{PythonCall.C.PyObject},
args_::Ptr{PythonCall.C.PyObject}, nargs::Int64)
@ PythonCall ~/.julia/packages/PythonCall/wXfah/src/jlwrap/base.jl:69
[14] _pyjl_callmethod(o::Ptr{PythonCall.C.PyObject},
args::Ptr{PythonCall.C.PyObject})
@ PythonCall.C ~/.julia/packages/PythonCall/wXfah/src/cpython/jlwrap.jl:47
Affects: JuliaCall
Describe the bug
I'm trying to call a Julia function (from Python) that returns a vector of objects generated via
pmapon multiple workers. (Not sure if thepmapis even relevant, just in case)Reproduce the bug
The error gets thrown as soon as I call this Julia function:
https://github.com/MaximeVH/EquivalentCircuits.jl/blob/875522d8c7da5a774b20d497cb045177c97017cf/src/CircuitEvolution.jl#L358-L399
Error message
Your system
Please provide detailed information about your system: