# MLJ.fit! complain "UndefVarError: level not defined" in a sysimage

**URL:** <https://discourse.julialang.org/t/mlj-fit-complain-undefvarerror-level-not-defined-in-a-sysimage/81499>\
**Category:** Machine Learning\
**Tags:** mlj\
**Created:** [May 23, 2022, 9:33am UTC](https://discourse.julialang.org/t/mlj-fit-complain-undefvarerror-level-not-defined-in-a-sysimage/81499 "2022-05-23T09:33:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tiZ](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tiz/32/211800_2.png) [@tiZ](https://discourse.julialang.org/u/tiZ)\
**Post date:** [May 23, 2022, 9:33am UTC](https://discourse.julialang.org/t/mlj-fit-complain-undefvarerror-level-not-defined-in-a-sysimage/81499/1 "2022-05-23T09:33:24Z")

</div>

Hello,

I try to fit a simple logistic regression in Julia, with a sysimage, which loaded these packages :

- “OhMyREPL” “Plots” “GLMakie” “DataFrames” “RCall” “PyCall” “CSV” “Flux” “Random” “TensorBoardLogger”

Here is my simple code:

```julia
using MLJ, ScikitLearn, MLJScikitLearnInterface, DataFrames
# demo data
df3 = DataFrame( X1 = randn(30), 
	X2 = randn(30), 
	X3 = randn(30), 
	y = repeat(["A","B"], 15))
coerce!(df3, :y => Multiclass)
# Then I also check the scitypes
df3 |> schema

mymodel = machine(LogisticClassifier(),
	select(df3, r"^X"), 
	df3.y)

# here the ERROR happened
MLJ.fit!(mymodel)

```

when I run the codes in a normal Julia env without sysimage, everything is OK, but when I run with the sysimage env, I got this ERROR:

> UndefVarError: level not defined
> 
> 1. getproperty @ _Base.jl:35_ [inlined]
> 2. int (::MLJModelInterface.FullInterface, ::CategoricalArrays.CategoricalValue{String, UInt32})@ _data\_utils.jl:22_
> 3. var"#int#9" (::Nothing, ::typeof(MLJModelInterface.int), ::CategoricalArrays.CategoricalValue{String, UInt32}) @ _data\_utils.jl:73_  
> …  
> …

but I have no idea what the `level` is. Thank for any suggestion to debug or correct my code.

---

<div class="post-metadata">

**Author:** ![skleinbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skleinbo/32/36080_2.png) [@skleinbo](https://discourse.julialang.org/u/skleinbo)\
**Post date:** [May 23, 2022, 9:48am UTC](https://discourse.julialang.org/t/mlj-fit-complain-undefvarerror-level-not-defined-in-a-sysimage/81499/2 "2022-05-23T09:48:45Z")

</div>

`level` is in `CategoricalArrays.jl` but that shouldn’t matter I think.

I don’t have much experience with `PackageCompiler.jl`, but could there be a mismatch between package versions in your environment and the ones the sysimage was compiled with?
