JuliaDynamics / Agents.jl

Agent-based modeling framework in Julia
https://juliadynamics.github.io/Agents.jl/stable/
MIT License
725 stars 117 forks source link

Visualization methods are not found when called #865

Closed Tortar closed 1 year ago

Tortar commented 1 year ago

On the dev version (but I'm sure this applies also in the 5.17.1) I tried to run many examples models in the Examples folder, but I find many of them throwing errors since visualization methods are not found, e.g. for https://github.com/JuliaDynamics/Agents.jl/blob/main/examples/schelling.jl I see these kind of errors

julia> figure, _ = abmplot(model; ac = groupcolor, am = groupmarker, as = 10)
ERROR: MethodError: no method matching abmplot(::UnremovableABM{GridSpaceSingle{2, false}, SchellingAgent, Agents.Schedulers.Randomly, Dict{Symbol, Int64}, Xoshiro}; ac::typeof(groupcolor), am::typeof(groupmarker), as::Int64)
Stacktrace:
 [1] top-level scope
   @ REPL[130]:1
julia> abmvideo(
           "schelling.mp4", model, agent_step!;
           ac = groupcolor, am = groupmarker, as = 10,
           framerate = 4, frames = 20,
           title = "Schelling's segregation model"
       )
ERROR: MethodError: no method matching abmvideo(::String, ::UnremovableABM{GridSpaceSingle{2, false}, SchellingAgent, Agents.Schedulers.Randomly, Dict{Symbol, Int64}, Xoshiro}, ::typeof(agent_step!); ac::typeof(groupcolor), am::typeof(groupmarker), as::Int64, framerate::Int64, frames::Int64, title::String)
Stacktrace:
 [1] top-level scope
   @ REPL[137]:1

I think these errors have something to do with how the package extension is handled, but I'm not sure.

cc. @Datseris maybe this can have something to do with #851 ?

Tortar commented 1 year ago

It seems like it is defined but no methods are available

julia> using Agents

julia> methods(abmplot)
# 0 methods for generic function "abmplot" from Agents
Tortar commented 1 year ago

ok I understood what is the problem: the visualization extension doesn't compile since it is triggered only by Makie, not back-ends, will fix the problem in a couple of hours

Tortar commented 1 year ago

Closed by #867