Loaded v1.10.2; receiving LoadError: MethodError: no method matching var"@agent

Hello,

I’ve installed the latest version 1.10.2 and using the predator-prey example. When I run my code (shown below) and the predator-prey code, both get the same error message:

LoadError: MethodError: no method matching var"@agent

@agent struct Bank(GridAgent{2})
	uninsured::Int              #uninsured deposit to total deposits of 100
	investments::Int				#long-term investments to total deposits of 100
	totDep::Int							#total deposits 
	health::Bool						#open=true or failed=false
	vul::Bool						    #vulnerable=true or not vulnerable=false
    AFS_securities::Int                 #available-for-sale securities
end


@agent struct Depositor(GridAgent{2})  
    social_network::Int
end

Here are the versions of the installed packages:

Status ~/Project.toml
⌅ [46ada45e] Agents v4.3.1
[7820620d] AgentsPlots v0.4.2
⌃ [13f3f980] CairoMakie v0.7.5
⌃ [e9467ef8] GLMakie v0.5.5
⌃ [ec714cd0] InteractiveDynamics v0.19.5
⌃ [f0f68f2c] PlotlyJS v0.18.12
⌃ [91a5bcdd] Plots v1.32.0

Thank you.

this is 4 years old version.

1 Like

This is deprecated, don’t use it.

Visit latest docs (v6) and copy the example from there!

1 Like

Thank you very much.

I ran the import Pkg; Pkg.add("Agents") but is still showing v4.3.1.

Is there something I should check that is preventing the update to v6?

You probably need to remove the InteractiveDynamics.jl package. Also try updating all packages since they all show as outdated. If it doesn’t work please post the terminal lutput here (enclosed in ```).

Hello,

Thank you for your suggestion. I removed all packages with Pkg.rm(" "), added packages, but still not v6.

Status ~/Project.toml
⌃ [46ada45e] Agents v4.3.1
⌃ [13f3f980] CairoMakie v0.7.5
⌃ [e9467ef8] GLMakie v0.5.5
[9a3f8284] Random
Info Packages marked with ⌃ have new versions available and may be upgradable.

I’ll close the file and VS Code to see if that will clear something out. Thanks.

Hooray. Closing and restarting worked. Thank you so much!

Status ~/.julia/environments/v1.10/Project.toml
[46ada45e] Agents v6.0.7
[13f3f980] CairoMakie v0.11.10
[9a3f8284] Random