@ode_def not defined

I am using DifferentialEquations.jl in a Julia Notebook. The code starts as:

using DifferentalEquations
using ParameterizedFunctions

sir_ode = @ode_def SIRModel begin
     dS = -β*S*I
     dI = β*S*I-γ*I
     dR = γ*I
     end β γ

When executed, I get the error:

UndefVarError: @ode_def not defined

That does not seem possible. What can I do about it? Thanks.

That doesn’t seem possible. uhh, what versions?

You are correct, it does not seem possible. Here is a status list of precompiled binaries in Julia 1.4.

Status `~/.julia/environments/v1.4/Project.toml`
  [c52e3926] Atom v0.12.11
  [fbb218c0] BSON v0.2.6
  [aae01518] BandedMatrices v0.15.7
  [6e4b80f9] BenchmarkTools v0.5.0
  [0487d830] Bifurcations v0.0.1 #master (https://github.com/tkf/Bifurcations.jl.git)
  [2b5f629d] DiffEqBase v6.35.1
  [aae7a2af] DiffEqFlux v1.10.3
  [9fdde737] DiffEqOperators v4.10.0
  [0c46a032] DifferentialEquations v6.14.0
  [bbc10e6e] DynamicHMC v2.1.0
  [5789e2e9] FileIO v1.3.0
  [587475ba] Flux v0.10.4
  [7073ff75] IJulia v1.21.2
  [82e4d734] ImageIO v0.1.1
  [916415d5] Images v0.22.2
  [18b7da76] JuliaAcademyData v0.1.0 #master (https://github.com/JuliaComputing/JuliaAcademyData.jl)
  [e5e0dc1b] Juno v0.8.2
  [ee78f7c6] Makie v0.10.0
  [429524aa] Optim v0.21.0
  [65888b18] ParameterizedFunctions v5.3.0
  [d96e819e] Parameters v0.12.1
  [91a5bcdd] Plots v0.29.9
  [92933f4c] ProgressMeter v1.3.0
  [7186c646] PyDSTool v0.6.0
  [d330b81b] PyPlot v2.9.0
  [295af30f] Revise v2.6.7
  [efcf1570] Setfield v0.6.0
  [90137ffa] StaticArrays v0.12.3
  [37b6cedf] Traceur v0.3.1
  [37e2e46d] LinearAlgebra 

I just typed into my notebook (did the same in Atom):

MethodError: no method matching @ode_def(::LineNumberNode, ::Module)
Closest candidates are:
  @ode_def(::LineNumberNode, ::Module, !Matched::Any, !Matched::Any, !Matched::Any...) at /Users/erlebach/.julia/packages/ParameterizedFunctions/xErQf/src/macros.jl:2

which suggests that @ode_def was found. So I will try to use it again. But I am sure that what I reported happened.

I exited Jupyter and started it up again. The problem went away. As usual: “rebooting” solves many issues. Not elegant though.

Did your packages update mid-notebook? If you do that, you need a new Julia session to use the newer versions, so it could be something like that?

1 Like