Failing precompilation for DecisionTree

Hey Julia community,

For the past few months, the command using DecisionTree (as well as using MLJDecisionTreeInterface) has been met with the error message below on my machine. These packages previously worked fine for me—I have no idea what changed. I suspect I’m missing something basic about how packages are managed.

I’d be grateful for any advice! I’m also including the outputs from versioninfo() and ]st below. Please let me know if I should include anything else, or if I ought to post this under a different topic.

Thanks,

ADM

Error message:

julia> using DecisionTree
[ Info: Precompiling DecisionTree [7806a523-6efd-50cb-b5f6-3fa6f1930dbb]
ERROR: LoadError: UndefVarError: `AbstractNode` not defined
Stacktrace:
 [1] getproperty(x::Module, f::Symbol)
   @ Base ./Base.jl:31
 [2] top-level scope
   @ ~/.julia/packages/DecisionTree/4lZKc/src/abstract_trees.jl:18
 [3] include(mod::Module, _path::String)
   @ Base ./Base.jl:457
 [4] include(x::String)
   @ DecisionTree ~/.julia/packages/DecisionTree/4lZKc/src/DecisionTree.jl:1
 [5] top-level scope
   @ ~/.julia/packages/DecisionTree/4lZKc/src/DecisionTree.jl:84
 [6] include
   @ ./Base.jl:457 [inlined]
 [7] 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:2010
 [8] top-level scope
   @ stdin:2
in expression starting at /Users/alexandermeyer/.julia/packages/DecisionTree/4lZKc/src/abstract_trees.jl:18
in expression starting at /Users/alexandermeyer/.julia/packages/DecisionTree/4lZKc/src/DecisionTree.jl:1
in expression starting at stdin:2
ERROR: Failed to precompile DecisionTree [7806a523-6efd-50cb-b5f6-3fa6f1930dbb] to "/Users/alexandermeyer/.julia/compiled/v1.9/DecisionTree/jl_TjLSb7".
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
    @ Base ./loading.jl:2260
  [3] compilecache
    @ ./loading.jl:2127 [inlined]
  [4] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:1770
  [5] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1625
  [6] macro expansion
    @ ./loading.jl:1613 [inlined]
  [7] macro expansion
    @ ./lock.jl:267 [inlined]
  [8] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1576
  [9] eval
    @ ./boot.jl:370 [inlined]
 [10] eval
    @ ./Base.jl:68 [inlined]
 [11] repleval(m::Module, code::Expr, #unused#::String)
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.47.2/scripts/packages/VSCodeServer/src/repl.jl:222
 [12] (::VSCodeServer.var"#107#109"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.47.2/scripts/packages/VSCodeServer/src/repl.jl:186
 [13] with_logstate(f::Function, logstate::Any)
    @ Base.CoreLogging ./logging.jl:514
 [14] with_logger
    @ ./logging.jl:626 [inlined]
 [15] (::VSCodeServer.var"#106#108"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.47.2/scripts/packages/VSCodeServer/src/repl.jl:187
 [16] #invokelatest#2
    @ ./essentials.jl:816 [inlined]
 [17] invokelatest(::Any)
    @ Base ./essentials.jl:813
 [18] macro expansion
    @ ~/.vscode/extensions/julialang.language-julia-1.47.2/scripts/packages/VSCodeServer/src/eval.jl:34 [inlined]
 [19] (::VSCodeServer.var"#61#62")()
    @ VSCodeServer ./task.jl:514

Output of versioninfo():

Julia Version 1.9.0
Commit 8e630552924 (2023-05-07 11:25 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin22.4.0)
  CPU: 12 × Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, skylake)
  Threads: 6 on 12 virtual cores
Environment:
  JULIA_EDITOR = 
  JULIA_NUM_THREADS = 6
  JULIA_IMAGE_THREADS = 1

Output of ]st:

⌃ [cbdf2221] AlgebraOfGraphics v0.6.7
⌃ [131c737c] ArviZ v0.5.22
  [c52e3926] Atom v0.12.38
  [6e4b80f9] BenchmarkTools v1.3.2
⌃ [024491cd] BetaML v0.7.0
  [e2ed5e7c] Bijections v0.1.4
  [336ed68f] CSV v0.10.11
⌃ [13f3f980] CairoMakie v0.8.9
  [aaaa29a8] Clustering v0.15.3
  [35d6a980] ColorSchemes v3.21.0
  [861a8166] Combinatorics v1.0.2
⌅ [34da2185] Compat v3.46.2
  [7d11a335] ConcaveHull v1.1.0
⌃ [ae264745] Copulas v0.1.0
⌃ [a93c6f00] DataFrames v1.3.6
  [864edb3b] DataStructures v0.18.13
⌃ [7806a523] DecisionTree v0.12.1
⌃ [0c46a032] DifferentialEquations v6.20.0
  [b4f34e82] Distances v0.10.8
⌃ [31c24e10] Distributions v0.25.96
  [f6006082] EvoTrees v0.14.11
  [2fe49d83] Expectations v1.9.0
  [7a1cc6ca] FFTW v1.7.1
  [587475ba] Flux v0.13.17
  [d9f16b24] Functors v0.4.4
  [38e38edf] GLM v1.8.3
  [5752ebe1] GMT v1.1.1
  [c91e804a] Gadfly v1.4.0
⌃ [2fb1d81b] GeoArrays v0.7.5
  [9b6fcbb8] GeoData v0.6.1
  [7073ff75] IJulia v1.24.2
  [a98d9a8b] Interpolations v0.14.7
  [033835bb] JLD2 v0.4.31
  [682c06a0] JSON v0.21.4
  [e5e0dc1b] Juno v0.8.4
  [5ab0869b] KernelDensity v0.6.7
  [b1bec4e5] LIBSVM v0.8.0
  [a5e1c1ea] LatinHypercubeSampling v1.9.0
  [92481ed7] LinearRegression v0.2.1
⌃ [bdcacae8] LoopVectorization v0.12.101
⌃ [eb30cadb] MLDatasets v0.5.15
⌃ [add582a8] MLJ v0.18.6
  [c6f25543] MLJDecisionTreeInterface v0.4.0
  [af6c499f] MutableNamedTuples v0.1.3
⌅ [85f8d34a] NCDatasets v0.11.9
  [2774e3e8] NLsolve v4.5.1
  [636a865e] NearestNeighborModels v0.2.3
  [b8a86587] NearestNeighbors v0.4.13
  [429524aa] Optim v1.7.6
  [e4faabce] PProf v2.2.2
⌅ [a68b5a21] ParetoSmooth v0.6.6
  [54e51dfa] PerceptualColourMaps v0.3.6
⌃ [c3e4b0f8] Pluto v0.19.9
  [7f904dfe] PlutoUI v0.7.51
  [e409e4f3] PoissonRandom v0.4.4
  [647866c9] PolygonOps v0.1.2
  [c46f51b8] ProfileView v1.7.1
  [49802e3a] ProgressBars v1.5.0
  [92933f4c] ProgressMeter v1.7.2
  [6f49c342] RCall v0.13.15
  [e6cf234a] RandomNumbers v1.5.3
  [f2b01f46] Roots v2.0.17
⌃ [8e980c4a] Shapefile v0.7.4
⌅ [276daf66] SpecialFunctions v1.8.8
⌃ [2d09df54] StatisticalRethinking v4.0.4
⌅ [2913bbd2] StatsBase v0.33.21
  [09ab397b] StructArrays v0.6.15
  [37b6cedf] Traceur v0.3.1
⌃ [fce5fe82] Turing v0.26.0
  [770da0de] UpdateJulia v0.4.2
  [fdbf4ff8] XLSX v0.9.0
  [37e2e46d] LinearAlgebra
  [44cfe95a] Pkg v1.9.0
  [9abbd945] Profile
  [9a3f8284] Random
  [10745b16] Statistics v1.9.0
Info Packages marked with ⌃ and ⌅ have new versions available, but those with ⌅ are restricted by compatibility constraints from upgrading. To see why use `status --outdated`

Can you try Julia 1.9.1 and the latest DecisionTree version (0.12.3)?

On a general note, you are making the classic mistake of having a very crowded global environment which will almost guarantee version conflicts and packages being held back (e.g. I see DataFrames at version 1.3.6 when the latest is 1.5). Don’t do this, work in project-specific environments instead to which you only add the packages you need for whatever you are working on.

1 Like

@nilshg You’re absolutely right, thank you! I was worried my package mismanagement would get me in trouble someday.

For anyone who stumbles upon this thread in the future, here’s a soft introduction to setting up project environments: How to setup Project Environments in Julia | by René | Towards Data Science

Thanks again,

ADM

1 Like