Julia multithreading from pycall - possible to overcome?

Say I have a jupyter notebook:


using Pkg
using DecisionTree

X = Vector([1.1,2.2,3.3])
Y = Vector([1.1,2.2,3.3])
X = reshape(X, size(X))

X = Float32.(X)
Y = Float32.(Y)
model = DecisionTree.build_forest(Y, X’)

From what I know DecisionTree.jl uses multithreading, which pycall does not support, which results in the error:

RuntimeError: <PyCall.jlwrap (in a Julia function called from Python)
JULIA: TaskFailedException
[1] wait
@ .\task.jl:334 [inlined]
[2] threading_run(func::Function)
@ Base.Threads .\threadingconstructs.jl:38
[3] macro expansion
@ .\threadingconstructs.jl:97 [inlined]
[4] build_forest(labels::Vector{Float32}, features::LinearAlgebra.Adjoint{Float32, Vector{Float32}}, n_subfeatures::Int64, n_trees::Int64, partial_sampling::Float64, max_depth::Int64,

My question is - is there any way to make it work after all?

Running into similar problems with PythonCall.jl, so I’m definitely interested in the answer

@gdalle, @goerch actually posted my own question on stackoverflow xD anyways, the problem is the size and type of the inputs, in julia the errors are kind of counterintuitive. If you have any further problem, let us know here, since my problem is solved maybe we could help you