# Problem in solve() DifferentialEquations. None algorithm define

**URL:** <https://discourse.julialang.org/t/problem-in-solve-differentialequations-none-algorithm-define/113342>\
**Category:** Modelling & Simulations\
**Tags:** question, ode, differentialequation\
**Created:** [April 22, 2024, 2:36pm UTC](https://discourse.julialang.org/t/problem-in-solve-differentialequations-none-algorithm-define/113342 "2024-04-22T14:36:36Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marta\_Pardo\_Araujo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marta_pardo_araujo/32/208774_2.png) [@Marta\_Pardo\_Araujo](https://discourse.julialang.org/u/Marta_Pardo_Araujo)\
**Post date:** [April 22, 2024, 2:36pm UTC](https://discourse.julialang.org/t/problem-in-solve-differentialequations-none-algorithm-define/113342/1 "2024-04-22T14:36:36Z")

</div>

Hi,

I am new to Julia. I am trying to integrate an ODE. It works in my colleagues PC but not in mine. It looks like the package has not been loaded but I did it at the beginning of the script. I have tried with many solvers and all gives the same error:  
ERROR: UndefVarError: `Vern7` not defined

The code is:

```julia
# Load pkgs and remove data -----------------------------------------------------
using DifferentialEquations
using DataFrames
using CSV
using Plots
using Shapefile
using PlotShapefiles
import GeoDataFrames as GDF
using LinearAlgebra
using ODE
#using LSODA
#using Interpolations
#using OrdinaryDiffEq

# For after do a separate file
#include("~/albo_mobility/code/Hanski/ode_model.jl") # Code with ODE model

# Set const parameters
# Set constants to estimate to random variables to create fake observed data
e = rand(Float64) * 0.01 # extinction constant (estimate)
c_d = rand(Float64) * 0.00000001 # colonization constant (estimate)
c_h = rand(Float64) * 0.001 # colonization constant (estimate)
xi = rand(Float64) # dispersal scaling parameter (estimate)

println(e)

# These variables might be estimated in the future
m_c = 0.001 # probability of mosquito in a car
alpha = 1 / 200 # average natural dispersal distance

# Load data input
...

# Set parameters
t0=0
tf=1824
tspan = (t0, tf)
t_vect=1:tf

function fun(du, u, p, t)
  mat = exp.(-alpha*d_1)
  mat[diagind(mat)] .= 0 # Set to zero diagonal of distance
  Cd = c_d.*mat*u # Natural dispersal
  Ch = c_h.*(m_c*eta)*u # Human mobility
  du.= (xi .* Cd + (1 - xi) .* Ch) .* (1 .- u) - e .* u
end

p = 0 # We have to give a value
prob = ODEProblem(fun, pop_init, tspan, p)
rtol=1e-10
sol = DifferentialEquations.solve(prob,Tsits5()) # , maxiters=1e6) #reltol=1e-8) #, #
sol = OrdinaryDiffEq.solve(prob,Tsits5()) # , maxiters=1e6) #reltol=1e-8) #, #
sol = solve(prob, Vern7()) # , maxiters=1e6) #reltol=1e-8) #, #

```

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [April 22, 2024, 3:27pm UTC](https://discourse.julialang.org/t/problem-in-solve-differentialequations-none-algorithm-define/113342/2 "2024-04-22T15:27:37Z")

</div>

What Julia version and how did you install it?

---

<div class="post-metadata">

**Author:** ![Marta\_Pardo\_Araujo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marta_pardo_araujo/32/208774_2.png) [@Marta\_Pardo\_Araujo](https://discourse.julialang.org/u/Marta_Pardo_Araujo)\
**Post date:** [April 23, 2024, 8:37am UTC](https://discourse.julialang.org/t/problem-in-solve-differentialequations-none-algorithm-define/113342/3 "2024-04-23T08:37:14Z")

</div>

Hi Chris,

I am using Julia 1.10.2. I install following the info in the website:

> **[Download Julia](https://julialang.org/downloads/)**
>
> The official website for the Julia Language. Julia is a language that is fast, dynamic, easy to use, and open source. Click here to learn more.

It says to run in the terminal:

```julia
curl -fsSL https://install.julialang.org | sh

```

and I use Visual code to run it. I am working in Ubuntu 20.04.4.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [April 23, 2024, 10:24am UTC](https://discourse.julialang.org/t/problem-in-solve-differentialequations-none-algorithm-define/113342/4 "2024-04-23T10:24:55Z")

</div>

What is the output of:

```julia
using Pkg
Pkg.status()

```

?

---

<div class="post-metadata">

**Author:** ![Marta\_Pardo\_Araujo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marta_pardo_araujo/32/208774_2.png) [@Marta\_Pardo\_Araujo](https://discourse.julialang.org/u/Marta_Pardo_Araujo)\
**Post date:** [April 23, 2024, 10:58am UTC](https://discourse.julialang.org/t/problem-in-solve-differentialequations-none-algorithm-define/113342/5 "2024-04-23T10:58:47Z")

</div>

It is solved. Thanks for the help

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [April 23, 2024, 3:50pm UTC](https://discourse.julialang.org/t/problem-in-solve-differentialequations-none-algorithm-define/113342/6 "2024-04-23T15:50:22Z")

</div>

> [@Marta\_Pardo\_Araujo](#):
>
> It is solved.

Do you know how it was solved? This might help others…

---

<div class="post-metadata">

**Author:** ![Marta\_Pardo\_Araujo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marta_pardo_araujo/32/208774_2.png) [@Marta\_Pardo\_Araujo](https://discourse.julialang.org/u/Marta_Pardo_Araujo)\
**Post date:** [April 24, 2024, 2:08pm UTC](https://discourse.julialang.org/t/problem-in-solve-differentialequations-none-algorithm-define/113342/7 "2024-04-24T14:08:27Z")

</div>

I do not know. Now i have the problem that each time I open visual code I have to install DifferentialEquations package. Otherwise I get the error: ERROR: LoadError: UndefVarError: `SciMLBase`not defined. And now when i run the ODEProblem(fun, op,…) if give me the error that its not defined aswell…

What could be the reason?

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [April 24, 2024, 2:14pm UTC](https://discourse.julialang.org/t/problem-in-solve-differentialequations-none-algorithm-define/113342/8 "2024-04-24T14:14:09Z")

</div>

You must be sure that the correct environment is opened. In VSCode,  
at the bottom you can see the the active environment like:

```julia
Julia env: KiteControllers.jl

```

if the environment (Project.toml) in the folder `KiteControllers.jl` is active.

If you click on the name of the environment you get a dialog that allows you to activate a different environment.

If DifferentialEquations.jl is part of your active project, then you can use it.

---

<div class="post-metadata">

**Author:** ![Marta\_Pardo\_Araujo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marta_pardo_araujo/32/208774_2.png) [@Marta\_Pardo\_Araujo](https://discourse.julialang.org/u/Marta_Pardo_Araujo)\
**Post date:** [April 24, 2024, 2:15pm UTC](https://discourse.julialang.org/t/problem-in-solve-differentialequations-none-algorithm-define/113342/9 "2024-04-24T14:15:45Z")

</div>

It says Julia env:v1.10 So where the julia is intalled. Should I create another enviroment? I always using this

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [April 24, 2024, 2:19pm UTC](https://discourse.julialang.org/t/problem-in-solve-differentialequations-none-algorithm-define/113342/10 "2024-04-24T14:19:42Z")

</div>

Always use a separate environment per project.  
Like:

```julia
mkdir myproject
cd myproject
julia --project="."

```

And then in Julia:

```julia
using Pkg
pkg"add DifferentialEquations"
# ... and all the other packages you need for this specific project

```

This avoids conflicts if you need the newest version of a package in project A, but that conflicts with another package that you need in project B…

After you created, start Julia like this:

```julia
julia --project

```

If you open a folder in VSCode it activates the project (Project.toml) that is present in that folder automatically.

---

<div class="post-metadata">

**Author:** ![Marta\_Pardo\_Araujo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marta_pardo_araujo/32/208774_2.png) [@Marta\_Pardo\_Araujo](https://discourse.julialang.org/u/Marta_Pardo_Araujo)\
**Post date:** [April 24, 2024, 2:22pm UTC](https://discourse.julialang.org/t/problem-in-solve-differentialequations-none-algorithm-define/113342/11 "2024-04-24T14:22:27Z")

</div>

Perfect, thanks a lot. I have created a env in the git hub repo.

---

<div class="post-metadata">

**Author:** ![Marta\_Pardo\_Araujo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marta_pardo_araujo/32/208774_2.png) [@Marta\_Pardo\_Araujo](https://discourse.julialang.org/u/Marta_Pardo_Araujo)\
**Post date:** [April 25, 2024, 11:26am UTC](https://discourse.julialang.org/t/problem-in-solve-differentialequations-none-algorithm-define/113342/12 "2024-04-25T11:26:42Z")

</div>

I have used the enviroment as you told me. Today I open visual code in the environment that I have created and yesterday everything works but today I get the same problem with the using DifferentialEquations :

> DifferentialEquations  
> Info Given DifferentialEquations was explicitly requested, output will be shown live  
> WARNING: Method definition (::Type{Base.MPFR.BigFloat})(Base.Irrational{:invsqrt2π}) in module IrrationalConstants at irrationals.jl:223 overwritten in module StatsFuns on the same line (check for duplicate calls to `include`).  
> ERROR: Method overwriting is not permitted during Module precompilation. Use ` __precompile__ (false)` to opt-out of precompilation.  
> ✗ Adapt → AdaptStaticArraysExt  
> ? Distributions  
> ? DiffEqNoiseProcess  
> ✗ SteadyStateDiffEq  
> ? DiffEqFinancial  
> ? StochasticDiffEq  
> ? MultiScaleArrays  
> ? DifferentialEquations  
> 0 dependencies successfully precompiled in 34 seconds. 131 already precompiled.  
> 6 dependencies failed but may be precompilable after restarting julia  
> 6 dependencies had output during precompilation:  
> ┌ StochasticDiffEq  
> │ ERROR: LoadError: ArgumentError: Package AdaptStaticArraysCoreExt does not have Adapt in its dependencies:  
> │ - You may have a partially installed environment. Try `Pkg.instantiate()`  
> │ to ensure all packages in the environment are installed.  
> │ - Or, if you have AdaptStaticArraysCoreExt checked out for development and have  
> │ added Adapt as a dependency but haven’t updated your primary  
> │ environment’s manifest file, try `Pkg.resolve()`.  
> │ - Otherwise you may need to report an issue with AdaptStaticArraysCoreExt  
> │ Stacktrace:  
> │ [1] macro expansion  
> │ @ ./loading.jl:1776 [inlined]  
> │ [2] macro expansion  
> │ @ ./lock.jl:267 [inlined]  
> │ [3] \_\_require(into::Module, mod::Symbol)  
> │ @ Base ./loading.jl:1753  
> │ [4] #invoke\_in\_world#3  
> │ @ ./essentials.jl:926 [inlined]  
> │ [5] invoke\_in\_world  
> │ @ ./essentials.jl:923 [inlined]  
> │ [6] require(into::Module, mod::Symbol)  
> │ @ Base ./loading.jl:1746  
> │ [7] include  
> │ @ ./Base.jl:495 [inlined]  
> │ [8] include\_package\_for\_output(pkg::Base.PkgId, input::String, depot\_path::Vector{String}, dl\_load\_path::Vector{String}, load\_path::Vector{String}, concrete\_deps::Vector{Pair{Base.PkgId, UInt128}}, source::String)  
> │ @ Base ./loading.jl:2222  
> │ [9] top-level scope  
> │ @ stdin:3  
> │ in expression starting at /home/marta/.julia/packages/Adapt/Ur60R/ext/AdaptStaticArraysExt.jl:1  
> │ in expression starting at stdin:3  
> │ ┌ Error: Error during loading of extension AdaptStaticArraysExt of Adapt, use `Base.retry_load_extensions()` to retry.  
> │ │ exception =  
> │ │ 1-element ExceptionStack:  
> │ │ Failed to precompile AdaptStaticArraysExt [e1699a77-9e31-5da8-bb3e-0a796f95f0a0] to “/home/marta/.julia/compiled/v1.10/AdaptStaticArraysExt/jl\_oqeB7G”.  
> │ │ Stacktrace:  
> │ │ [1] error(s::String)  
> │ │ @ Base ./error.jl:35  
> │ │ [2] compilecache(pkg::Base.PkgId, path::String, internal\_stderr::IO, internal\_stdout::IO, keep\_loaded\_modules::Bool)  
> │ │ @ Base ./loading.jl:2468  
> │ │ [3] compilecache  
> │ │ @ ./loading.jl:2340 [inlined]  
> │ │ [4] (::Base.var"#968#969"{Base.PkgId})()  
> │ │ @ Base ./loading.jl:1974  
> │ │ [5] mkpidlock(f::Base.var"#968#969"{Base.PkgId}, at::String, pid::Int32; kwopts::@Kwargs{stale\_age::Int64, wait::Bool})  
> │ │ @ FileWatching.Pidfile ~/.julia/juliaup/julia-1.10.2+0.x64.linux.gnu/share/julia/stdlib/v1.10/FileWatching/src/pidfile.jl:93  
> │ │ [6] #mkpidlock#6  
> │ │ @ ~/.julia/juliaup/julia-1.10.2+0.x64.linux.gnu/share/julia/stdlib/v1.10/FileWatching/src/pidfile.jl:88 [inlined]  
> │ │ [7] trymkpidlock(::Function, ::Vararg{Any}; kwargs::@Kwargs{stale\_age::Int64})  
> │ │ @ FileWatching.Pidfile ~/.julia/juliaup/julia-1.10.2+0.x64.linux.gnu/share/julia/stdlib/v1.10/FileWatching/src/pidfile.jl:111  
> │ │ [8] #invokelatest#2  
> │ │ @ ./essentials.jl:894 [inlined]  
> │ │ [9] invokelatest  
> │ │ @ ./essentials.jl:889 [inlined]  
> │ │ [10] maybe\_cachefile\_lock(f::Base.var"#968#969"{Base.PkgId}, pkg::Base.PkgId, srcpath::String; stale\_age::Int64)  
> │ │ @ Base ./loading.jl:2983  
> │ │ [11] maybe\_cachefile\_lock  
> │ │ @ ./loading.jl:2980 [inlined]  
> │ │ [12] \_require(pkg::Base.PkgId, env::Nothing)  
> │ │ @ Base ./loading.jl:1970  
> │ │ [13] \_\_require\_prelocked(uuidkey::Base.PkgId, env::Nothing)  
> │ │ @ Base ./loading.jl:1812  
> │ │ [14] #invoke\_in\_world#3  
> │ │ @ ./essentials.jl:926 [inlined]  
> │ │ [15] invoke\_in\_world  
> │ │ @ ./essentials.jl:923 [inlined]  
> │ │ [16] \_require\_prelocked  
> │ │ @ ./loading.jl:1803 [inlined]  
> │ │ [17] \_require\_prelocked  
> │ │ @ ./loading.jl:1802 [inlined]  
> │ │ [18] run\_extension\_callbacks(extid::Base.ExtensionId)  
> │ │ @ Base ./loading.jl:1295  
> │ │ [19] run\_extension\_callbacks(pkgid::Base.PkgId)  
> │ │ @ Base ./loading.jl:1330  
> │ │ [20] run\_package\_callbacks(modkey::Base.PkgId)  
> │ │ @ Base ./loading.jl:1164  
> │ │ [21] \_tryrequire\_from\_serialized(modkey::Base.PkgId, path::String, ocachepath::String, sourcepath::String, depmods::Vector{Any})  
> │ │ @ Base ./loading.jl:1487  
> │ │ [22] \_require\_search\_from\_serialized(pkg::Base.PkgId, sourcepath::String, build\_id::UInt128)

I do not know why this is happening. I have check that I am in the environment that I have created yesterday.  
If I rerun the using DifferentialEquations after the error it works. But there is another issue with the function ODEProblem  
ERROR: UndefVarError: `ODEProblem` not defined

Do you know what its the problem?
