# Error saving ScikitLearn.jl pipeline

**URL:** <https://discourse.julialang.org/t/error-saving-scikitlearn-jl-pipeline/99614>\
**Category:** General Usage\
**Created:** [May 30, 2023, 4:09pm UTC](https://discourse.julialang.org/t/error-saving-scikitlearn-jl-pipeline/99614 "2023-05-30T16:09:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![klaus.68](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/klaus.68/32/33597_2.png) [@klaus.68](https://discourse.julialang.org/u/klaus.68)\
**Post date:** [May 30, 2023, 4:09pm UTC](https://discourse.julialang.org/t/error-saving-scikitlearn-jl-pipeline/99614/1 "2023-05-30T16:09:52Z")

</div>

Hi,

I’m trying to save a ScikitLearn pipeline but JLD is encountering a fatal error. A MWE is below. My versions are `ScikitLearn@v0.7.0`, `JLD@v0.10.0`, `PyCallJLD@v0.2.1`. `Pkg.status(outdated=true)` returns that PyCallJLD is prohibiting an update in JLD. Any advice for how I can fix the issue? Thanks in advance! (Apologies if the markdown doesn’t come through. I wasn’t clear how to format the code in the discourse.)

```julia
using ScikitLearn,JLD,PyCallJLD;

@sk_import preprocessing: (OneHotEncoder,FunctionTransformer);
@sk_import compose: ColumnTransformer;

function colshndl(X0::AbstractArray)
    ids = [2,3];   
    X = hcat(X0,X0[:,ids]);
    
    return X
end;

cols_ft = FunctionTransformer(colshndl);

ohot_ct = ColumnTransformer([("cat1",OneHotEncoder(),[0]),
                            ("cat2",OneHotEncoder(categories=[[-1]],handle_unknown="ignore"),[15]),
                            ("cat3",OneHotEncoder(categories=[[-1]],handle_unknown="ignore"),[16]),
                            ("cat4",OneHotEncoder(),[3]),
                            ("cat5",OneHotEncoder(),[4]),
                            ("cat6",OneHotEncoder(),[5]),
                            ("cat7",OneHotEncoder(categories=[[-1]],handle_unknown="ignore"),[8]),
                            ("cat8",OneHotEncoder(categories=[[-1]],handle_unknown="ignore"),[9]),
                            ("cat9",OneHotEncoder(),[13]),
                            ("cat10",OneHotEncoder(),[14])],
                            remainder="passthrough");

prepipe = Pipelines.Pipeline([("cols",cols_ft),
                              ("ohot",ohot_ct)]);
X = rand(141,15);
fit!(prepipe,X);

JLD.save("error.jld","prepipe",prepipe);

```

The error returned is

> ┌ Warning: JLD incorrectly extends FileIO functions (see FileIO documentation)  
> └ @ FileIO C:\Users\Colin.julia\packages\FileIO\BE7iZ\src\loadsave.jl:217  
> Error encountered while save FileIO.File{FileIO.DataFormat{:JLD}, String}(“error.jld”).

Fatal error:  
type DataType has no field mutable
