ERROR using JumpProcesses and Catalyst

I’m trying to run this code (julia version 1.9.2) found on Continuous-Time Jump Processes and Gillespie Methods · JumpProcesses.jl and I get the error "JumpSystem equations must contain MassActionJumps, ConstantRateJumps, or VariableRateJumps.
"
using Catalyst,JumpProcesses
sir_model = @reaction_network begin
β, S + I → 2I
ν, I → R
end
p = (:β => 0.1 / 1000, :ν => 0.01)
u₀ = [:S => 990, :I => 10, :R => 0]
tspan = (0.0, 250.0)
prob = DiscreteProblem(sir_model, u₀, tspan, p)

Can someone help me? Thanks in advance!

What package versions?

I’m using JumpProcesses v9.3.2 and Catalyst v12.1.1. I’ve just run Pkg.update() and these are the installed versions I have.

It’s always useful to run the versions for which you are reading the docs; clicking on your link you’ll see in the bottom left corner:

image

Likewise, the current Catalyst release seems to be 13.5.1 so your version is quite outdated.

Make sure you are working in a project-specific environment which only includes the packages you need for your analysis, see:

https://pkgdocs.julialang.org/v1/environments/

If for some reason you can’t use the latest versions of the packages you need, make sure to read the documentation for the versions you are using (as you see in the screenshot above you can select an older version of the docs from the dropdown menu).

Thank you for your answer, is there a reason for which the packages Catalyst and JumpProcesses were not installed in their latest version when I run "Pkg.add(“Catalyst”)?

The most common reason for getting older package versions is that you are installing these packages into your global environment in which you have another package installed that is incompatible with their most recent versions. That other package then prevents the latest version of them being installed. The easiest thing to do is create a new, empty environment for each project you are working on and just install the exact packages you need into it. That usually allows you to get the latest versions. A benefit of this approach is you can share the environment Project.toml and Manifest.toml with others to have a reproducible project.

For example, you could do

using Package

# creates a new environment in the current folder named catalyst_project
Pkg.activate("catalyst_project") 
Pkg.add("Catalyst")
Pkg.add("JumpProcesses")

This should result in you having the latest versions of these packages and your code working.

Thank you ! Creating a new environment worked well for me and I managed to install the latest versions of the packages.