I am trying to use the latest InteractiveDynamics v0.20 and Agents v5.0 as part of my project. Since yesterday, I am getting the following error, whenever I try to precompile my package.
ERROR: LoadError: UndefVarError: abmplot not defined
Stacktrace:
So, I tried to recreate it minimally as follows. I generated a new project ‘DaisyWorldTest’ using Pkg generate. I activated the project and added the following packages: Agents, InteractiveDynamics, CairoMakie, StatsBase, Random. The last two because the sample code requires it.
The project contains only two files
File 1: DaisyWorldTest.jl
module DaisyWorldTest
include("DaisyWorld.jl")
end # module
File 2: DaisyWorld.jl Exact same Agent Based Models · InteractiveDynamics (juliadynamics.github.io) Pasting it below for convenience
using InteractiveDynamics, Agents
using CairoMakie
daisypath = joinpath(dirname(pathof(InteractiveDynamics)), "agents", "daisyworld_def.jl")
include(daisypath)
model, daisy_step!, daisyworld_step! = daisyworld(; solar_luminosity = 1.0, solar_change = 0.0, scenario = :change)
daisycolor(a::Daisy) = a.breed # color of agents
as = 14 # size of agents
am = '♠' # marker of agents
heatarray = :temperature
heatkwargs = (colorrange = (-20, 60), colormap = :thermal)
plotkwargs = (;
ac = daisycolor, as, am,
scatterkwargs = (strokewidth = 1.0,),
heatarray, heatkwargs
)
fig, ax, abmobs = abmplot(model; plotkwargs...)
fig
I use VSCode and when I do Alt+Enter (aka Execute active file in REPL) on DaisyWorld.jl, everything works as expected and I can see the Plot!
But when I precompile the DaisyWorldTest package. I get UndefVarError: abmplot not defined error. I am planning to build a traffic simulation package which uses Agents.jl and InteractiveDynamics.jl. It won’t work for me, if I can’t use Agents and InteractiveDynamics as part of a another project.
Please help!