MethodError when trying to follow DiffEq tutorial


#1

Hallo, I was trying to follow the tutorial on differential equations available on Juliabox (ODEintroduction), on a brand new installation of JuliaPro (v…6.2.1), but I have troubles:

using DifferentialEquations
f(u,p,t) = 0.98u
u0 = 1.0
tspan = (0.0,1.0)
prob = ODEProblem(f,u0,tspan)

ERROR: MethodError: objects of type Float64 are not callable
Stacktrace:
[1] alg_cache(::OrdinaryDiffEq.Tsit5, ::Float64, ::Float64, ::Type{T} where T, ::Type{T} where T, ::Float64, ::Float64, ::Function, ::Float64, ::Float64, ::Float64, ::Type{Val{true}}) at /opt/JuliaPro-0.6.2.1/JuliaPro/pkgs-0.6.2.1/v0.6/OrdinaryDiffEq/src/caches/low_order_rk_caches.jl:406
[2] #init#1831(::Int64, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Void, ::Bool, ::Void, ::Bool, ::Bool, ::Bool, ::Bool, ::Float64, ::Bool, ::Rational{Int64}, ::Void, ::Void, ::Int64, ::Rational{Int64}, ::Int64, ::Int64, ::Rational{Int64}, ::Bool, ::Int64, ::Rational{Int64}, ::Rational{Int64}, ::Int64, ::Float64, ::Float64, ::DiffEqBase.#ODE_DEFAULT_NORM, ::DiffEqBase.#ODE_DEFAULT_ISOUTOFDOMAIN, ::DiffEqBase.#ODE_DEFAULT_UNSTABLE_CHECK, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Int64, ::String, ::DiffEqBase.#ODE_DEFAULT_PROG_MESSAGE, ::Void, ::Void, ::Bool, ::Bool, ::Array{Any,1}, ::DiffEqBase.#init, ::DiffEqBase.ODEProblem{Float64,Float64,true,#f,Void,UniformScaling{Int64},DiffEqBase.StandardODEProblem}, ::OrdinaryDiffEq.Tsit5, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Type{Val{true}}) at /opt/JuliaPro-0.6.2.1/JuliaPro/pkgs-0.6.2.1/v0.6/OrdinaryDiffEq/src/solve.jl:217
[3] (::DiffEqBase.#kw##init)(::Array{Any,1}, ::DiffEqBase.#init, ::DiffEqBase.ODEProblem{Float64,Float64,true,#f,Void,UniformScaling{Int64},DiffEqBase.StandardODEProblem}, ::OrdinaryDiffEq.Tsit5, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Type{Val{true}}) at ./:0
[4] #solve#1830(::Array{Any,1}, ::Function, ::DiffEqBase.ODEProblem{Float64,Float64,true,#f,Void,UniformScaling{Int64},DiffEqBase.StandardODEProblem}, ::OrdinaryDiffEq.Tsit5, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Type{Val{true}}) at /opt/JuliaPro-0.6.2.1/JuliaPro/pkgs-0.6.2.1/v0.6/OrdinaryDiffEq/src/solve.jl:6
[5] (::DiffEqBase.#kw##solve)(::Array{Any,1}, ::DiffEqBase.#solve, ::DiffEqBase.ODEProblem{Float64,Float64,true,#f,Void,UniformScaling{Int64},DiffEqBase.StandardODEProblem}, ::OrdinaryDiffEq.Tsit5, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Type{Val{true}}) at ./:0 (repeats 2 times)
[6] #solve#2(::Bool, ::Array{Any,1}, ::Function, ::DiffEqBase.ODEProblem{Float64,Float64,true,#f,Void,UniformScaling{Int64},DiffEqBase.StandardODEProblem}, ::Void) at /opt/JuliaPro-0.6.2.1/JuliaPro/pkgs-0.6.2.1/v0.6/DifferentialEquations/src/default_solve.jl:14
[7] (::DiffEqBase.#kw##solve)(::Array{Any,1}, ::DiffEqBase.#solve, ::DiffEqBase.ODEProblem{Float64,Float64,true,#f,Void,UniformScaling{Int64},DiffEqBase.StandardODEProblem}, ::Void) at ./:0
[8] #solve#1(::Bool, ::Array{Any,1}, ::Function, ::DiffEqBase.ODEProblem{Float64,Float64,true,#f,Void,UniformScaling{Int64},DiffEqBase.StandardODEProblem}) at /opt/JuliaPro-0.6.2.1/JuliaPro/pkgs-0.6.2.1/v0.6/DifferentialEquations/src/default_solve.jl:5
[9] solve(::DiffEqBase.ODEProblem{Float64,Float64,true,#f,Void,UniformScaling{Int64},DiffEqBase.StandardODEProblem}) at /opt/JuliaPro-0.6.2.1/JuliaPro/pkgs-0.6.2.1/v0.6/DifferentialEquations/src/default_solve.jl:2


#2

Can you post the output of Pkg.status("DifferentialEquations")?

See here: http://docs.juliadiffeq.org/stable/tutorials/ode_example.html#Example-1-:-Solving-Scalar-Equations-1


#3

Hallo, I had v3.0.2:

julia > Pkg.status("DifferentialEquations")
 - DifferentialEquations         3.0.2

After a Pkg.update(), I have now version 3.1.0:

julia> Pkg.status("DifferentialEquations")
 - DifferentialEquations         3.1.0

… but I am not able to further update to v4.0.0:

julia> Pkg.update("DifferentialEquations")
INFO: Updating METADATA...
INFO: Computing changes...
INFO: Package DifferentialEquations was set to version 3.1.0, but a higher version 4.0.0 exists.
      To install the latest version, you could try doing a full update with `Pkg.update()`.
INFO: No packages to install, update or remove

julia> Pkg.update()
INFO: Updating METADATA...
INFO: Computing changes...
INFO: No packages to install, update or remove

How can I update to v4.0.0? Thanks!


#4

My guess is that’s the problem. @avik when’s the next JuliaPro update coming and can we make sure it is compatible with DiffEq 4.0?


Next version of Julia Pro and DataFrames
#5

I also have JuliaPro 0.6.2.1, with DifferentialEquations 3.1.0, so I tried the version of the tutorial in the documentation for 3.0 (http://docs.juliadiffeq.org/release-3.0/tutorials/ode_example.html. There seems to be documentation for 3.0 and 3.2.0, but not for 3.1.0. The basic tutorial is identical in 3.0 and 3.2):

using DifferentialEquations
f(t,u) = 1.01*u
u0=1/2
tspan = (0.0,1.0)
prob = ODEProblem(f,u0,tspan)
sol = solve(prob,Tsit5(),reltol=1e-8,abstol=1e-8)

This yields

MethodError: no method matching ODE_DEFAULT_UNSTABLE_CHECK(::Float64, ::Float64, ::Float64)

Any hints on how to use this version?


#6

Something looks out of sync here. What’s Pkg.status("OrdinaryDiffEq") and Pkg.status("DiffEqBase")?

But I think that passing unstable_check = (dt,u,t) -> false, isoutofdomain = (t,u)->false would do the trick. I would recommend just finding out what’s holding the package back and upgrading though.


#7
julia> Pkg.status("OrdinaryDiffEq")
 - OrdinaryDiffEq                2.26.0

julia> Pkg.status("DiffEqBase")
 - DiffEqBase                    3.6.0

julia> Pkg.status("DifferentialEquations")
 - DifferentialEquations         3.1.0

I would recommend just finding out what’s holding the package back and upgrading though.

Not sure how to do that. Pkg.update() just says “No packages to install, update or remove” rather than complaining that it can’t upgrade.

Before installing DifferentialEquations, I had installed OrdinaryDiffEq (thinking I don’t need the whole thing). Only after I couldn’t get it to work, and seeing the documentation about the API changes, I tried adding DifferentialEquations just to find what version number I get. So perhaps the problem is with the installation of OrdinaryDiffEqs on the current JuliaPro. I’ll try a fresh JuliaPro installation with Pkg.add("DifferentialEquations").


#8

I think the issue is JuliaPro. It pins a version of Optim that is old, which holds back all of JuliaNLSolvers, which holds back NLsolve.jl, which holds back a lot of DiffEq stuff. JuliaNLSolvers (Optim, NLsolve, etc.) did the upgrade the same time as us, so you’re getting weird versions at this point since JuliaPro hasn’t updated. @avik knows about this issue.


#9

Hi, I have a similar issue when trying to update the DifferentialEquations package except that I run Julia from the terminal and no JuliaPro

  _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.6.2 (2017-12-13 18:08 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/                   |  x86_64-apple-darwin14.5.0

julia> Pkg.status("DifferentialEquations")
 - DifferentialEquations         3.1.0

julia> Pkg.update("DifferentialEquations")
INFO: Updating METADATA...
INFO: Computing changes...
INFO: Package DifferentialEquations was set to version 3.1.0, but a higher version 4.5.0 exists.
      To install the latest version, you could try doing a full update with `Pkg.update()`.
INFO: No packages to install, update or remove

Removing the package and reinstalling a specific version results in the following:

julia> Pkg.add("DifferentialEquations",v"4.5.0")
ERROR: resolve is unable to satisfy package requirements.
  The problem was detected when trying to find a feasible version
  for package DiffEqUncertainty.
  However, this only means that package DiffEqUncertainty is involved in an
  unsatisfiable or difficult dependency relation, and the root of
  the problem may be elsewhere.

Increasing ENV[“JULIA_PKGRESOLVE_ACCURACY”] does not solve the problem.

Thank you for any suggestions


#10

Check Pkg.status("OrdinaryDiffEq"). That’s likely held back. The problem is because there was a package in the statistics ecosystem which put an upper bound that broke the package resolver.

I think it requires a clean wipe of the packages to get around it…


#11

Indeed, I can see similarities to


and julia> Pkg.status("OrdinaryDiffEq") gives - OrdinaryDiffEq 2.26.0 instead of the current version.

I did the package wipe and it works now! Thank you