Error from MLJ Iris example, no method matching?

I’m at the install/testing phase of Julia and attempting to run the Iris example of training a model using the Julia MLJ. I think I have it installed properly but am getting this error. What have I done incorrectly? Thx. J

julia> Tree = @load DecisionTreeClassifier pkg=DecisionTree
DecisionTreeClassifier(
    max_depth = -1,
    min_samples_leaf = 1,
    min_samples_split = 2,
    min_purity_increase = 0.0,
    n_subfeatures = 0,
    post_prune = false,
    merge_purity_threshold = 1.0,
    pdf_smoothing = 0.0,
    display_depth = 5,
    rng = Random._GLOBAL_RNG()) @226

julia> tree = Tree()
ERROR: MethodError: no method matching (::MLJDecisionTreeInterface.DecisionTreeClassifier)()
Closest candidates are:
  (::Supervised)(::Tuple{AbstractMatrix{T} where T, Any}) at /home/name/.julia/packages/MLJBase/8HFqb/src/composition/learning_networks/arrows.jl:25
  (::Supervised)(::Tuple{AbstractNode, AbstractNode}) at /home/name/.julia/packages/MLJBase/8HFqb/src/composition/learning_networks/arrows.jl:21
  (::Supervised)(::Tuple{AbstractNode, Any}) at /home/name/.julia/packages/MLJBase/8HFqb/src/composition/learning_networks/arrows.jl:22
  ...
Stacktrace:
 [1] top-level scope
   @ REPL[30]:1

hmm I can’t reproduce can you report your MLJ*, DecisionTree and Julia version?

With Julia 1.6.3 and

 [7806a523] DecisionTree v0.10.11
 [add582a8] MLJ v0.16.7
 [a7f614a8] MLJBase v0.18.23
 [c6f25543] MLJDecisionTreeInterface v0.1.3

I get:

julia> using MLJ

julia> DTC = @load DecisionTreeClassifier pkg=DecisionTree
[ Info: For silent loading, specify `verbosity=0`.
import MLJDecisionTreeInterface ✔
MLJDecisionTreeInterface.DecisionTreeClassifier

julia> DTC()
DecisionTreeClassifier(
    max_depth = -1,
    min_samples_leaf = 1,
    min_samples_split = 2,
    min_purity_increase = 0.0,
    n_subfeatures = 0,
    post_prune = false,
    merge_purity_threshold = 1.0,
    pdf_smoothing = 0.0,
    display_depth = 5,
    rng = Random._GLOBAL_RNG())

PS: you may like to consider Lab 8 - Tree-based models

Thanks tlienart,
I’m running julia 1.6.3 on ubuntu linux. I ran update to update all may packages and have what you show above however older versions of some? Would that make a difference? If so, why is update not updating to the most current versions and/or the ones that you are using? Thx. J.

(@v1.6) pkg> status
      Status `~/.julia/environments/v1.6/Project.toml`
  [7e6ae17a] BioSequences v2.0.5
  [336ed68f] CSV v0.9.10
  [a93c6f00] DataFrames v0.21.8
  [7806a523] DecisionTree v0.10.11
  [587475ba] Flux v0.11.3
  [7073ff75] IJulia v1.23.2
  [38d8eb38] Lathe v0.1.3
  [add582a8] MLJ v0.14.1
  [a7f614a8] MLJBase v0.15.7
  [c6f25543] MLJDecisionTreeInterface v0.1.3
  [1d978283] TensorFlow v0.11.0

DecisionTree is now the same v0.10.11
MLJ, mine is v0.14.1, yours v0.16.7
MLJbase, mine v0.15.7, yours v0.18.23
MLJDecisionTreeInterface is now the same v0.1.3

I shutdown, restarted and still get same error.

The problem was older, and seemingly un-updatable versions of some packages hanging around. So I removed ~/.julia/environments/v1.6/Manifest.toml … and Project.toml, restarted Julia, reinstalled the packages MLJ, DecisionTree, and MLJDecisionTreeInterface, and this time got the most recent vesions which match your status, and it runs fine! Thanks a bunch

It looks like you’re dumping all your packages into the default environment - don’t do this, work with project specific environments instead to ensure reproducibility and minimize version conflicts.

I can’t recreate your environment atm because I’m on a Windows machine and TensorFlow doesn’t install on Windows, but there are definitely version conflicts in there which prevent packages from upgrading - you should also be using DataFrames version 1.2.2, rather than 0.21.8.

You can do ] add MLJ@0.16 to figure out what’s wrong. The output will be a bit overwhelming, but it appears the problem is your old DataFrames version which restricts CategoricalArrays which in turn restricts MLJ.

Doing ] add DataFrames@1 then tells me:

(jl_uYe9CC) pkg> add DataFrames@1
   Resolving package versions...
ERROR: Unsatisfiable requirements detected for package DataFrames [a93c6f00]:
 DataFrames [a93c6f00] log:
 ├─possible versions are: 0.11.7-1.2.2 or uninstalled
 ├─restricted to versions 1 by an explicit requirement, leaving only versions 1.0.0-1.2.2
 └─restricted by compatibility requirements with Lathe [38d8eb38] to versions: 0.11.7-0.22.7 — no versions left
   └─Lathe [38d8eb38] log:
     ├─possible versions are: 0.0.3-0.1.8 or uninstalled
     └─restricted to versions * by an explicit requirement, leaving only versions 0.0.3-0.1.8

so the underlying problem is Lathe, which restricts DataFrames to 0.22. It looks like the Lathe package hasn’t been updated in half a year, so probably raise an issue there to bump compat to DataFrames 1 if you want to use it together with other packages.