When I tried to run the code in the Turing tutorial, the following error occurred when running to beyesianSDE, why is it?
What code did you run?
Turing tutorial : Bayesian Estimation of Differential Equations,The last part, Inference of a Stochastic Differential Equation,When I run to the following part,the problem I described above appears
What version of Julia are you on?
I’m assuming you mean this tutorial: Bayesian Estimation of Differential Equations
I was curious to try it out, but installing Turing
leads to several seemingly important downgrades. In case this is useful, here is the output of Pkg.add("Turing")
immediately after Pkg.add("DifferentialEquations")
on a new environment and Julia v1.7
.
Resolving package versions...
ERROR: LoadError: Unsatisfiable requirements detected for package AdvancedPS [576499cb]:
AdvancedPS [576499cb] log:
├─possible versions are: 0.1.0-0.3.0 or uninstalled
├─restricted by compatibility requirements with Libtask [6f1fad26] to versions: 0.1.0-0.2.4 or uninstalled
│ └─Libtask [6f1fad26] log:
│ ├─possible versions are: 0.1.1-0.6.1 or uninstalled
│ ├─restricted by compatibility requirements with Turing [fce5fe82] to versions: 0.1.1-0.5.3
│ │ └─Turing [fce5fe82] log:
│ │ ├─possible versions are: 0.5.0-0.19.2 or uninstalled
│ │ ├─restricted to versions * by an explicit requirement, leaving only versions 0.5.0-0.19.2
│ │ ├─restricted by compatibility requirements with MCMCChain [1671dc4f] to versions: 0.6.11-0.19.2 or uninstalled, leaving only versions: 0.6.11-0.19.2
│ │ │ └─MCMCChain [1671dc4f] log:
│ │ │ ├─possible versions are: 0.1.0-0.2.3 or uninstalled
│ │ │ └─restricted by julia compatibility requirements to versions: uninstalled
│ │ ├─restricted by compatibility requirements with Requires [ae029012] to versions: 0.8.0-0.19.2 or uninstalled, leaving only versions: 0.8.0-0.19.2
│ │ │ └─Requires [ae029012] log:
│ │ │ ├─possible versions are: 0.5.0-1.2.0 or uninstalled
│ │ │ ├─restricted by compatibility requirements with Plots [91a5bcdd] to versions: 0.5.0-1.2.0
│ │ │ │ └─Plots [91a5bcdd] log:
│ │ │ │ ├─possible versions are: 0.12.1-1.25.3 or uninstalled
│ │ │ │ ├─restricted to versions * by an explicit requirement, leaving only versions 0.12.1-1.25.3
│ │ │ │ ├─restricted by compatibility requirements with StatsPlots [f3b207a7] to versions: 0.14.0-1.25.3
│ │ │ │ │ └─StatsPlots [f3b207a7] log:
│ │ │ │ │ ├─possible versions are: 0.10.0-0.14.30 or uninstalled
│ │ │ │ │ ├─restricted to versions * by an explicit requirement, leaving only versions 0.10.0-0.14.30
│ │ │ │ │ └─restricted by compatibility requirements with Reexport [189a3867] to versions: 0.14.18-0.14.30 or uninstalled, leaving only versions: 0.14.18-0.14.30
│ │ │ │ │ └─Reexport [189a3867] log:
│ │ │ │ │ ├─possible versions are: 0.2.0-1.2.2 or uninstalled
│ │ │ │ │ ├─restricted by compatibility requirements with Plots [91a5bcdd] to versions: 0.2.0-1.2.2
│ │ │ │ │ │ └─Plots [91a5bcdd] log: see above
│ │ │ │ │ └─restricted by compatibility requirements with LinearSolve [7ed4a6bd] to versions: 1.0.0-1.2.2
│ │ │ │ │ └─LinearSolve [7ed4a6bd] log:
│ │ │ │ │ ├─possible versions are: 0.1.0-1.1.2 or uninstalled
│ │ │ │ │ └─restricted by compatibility requirements with DifferentialEquations [0c46a032] to versions: 1.0.0-1.1.2
│ │ │ │ │ └─DifferentialEquations [0c46a032] log:
│ │ │ │ │ ├─possible versions are: 5.0.0-6.21.0 or uninstalled
│ │ │ │ │ └─restricted to versions 6.21.0 by an explicit requirement, leaving only versions 6.21.0
│ │ │ │ ├─restricted by compatibility requirements with StaticArrays [90137ffa] to versions: 0.21.0-1.25.3 or uninstalled, leaving only versions: 0.21.0-1.25.3
│ │ │ │ │ └─StaticArrays [90137ffa] log:
│ │ │ │ │ ├─possible versions are: 0.8.0-1.2.13 or uninstalled
│ │ │ │ │ ├─restricted by compatibility requirements with ModelingToolkit [961ee093] to versions: 0.10.0-1.2.13
│ │ │ │ │ │ └─ModelingToolkit [961ee093] log:
│ │ │ │ │ │ ├─possible versions are: 0.0.1-7.1.3 or uninstalled
│ │ │ │ │ │ ├─restricted by compatibility requirements with ParameterizedFunctions [65888b18] to versions: 1.3.0-7.1.3
│ │ │ │ │ │ │ └─ParameterizedFunctions [65888b18] log:
│ │ │ │ │ │ │ ├─possible versions are: 3.2.0-5.12.2 or uninstalled
│ │ │ │ │ │ │ ├─restricted by compatibility requirements with DifferentialEquations [0c46a032] to versions: 5.0.0-5.12.2
│ │ │ │ │ │ │ │ └─DifferentialEquations [0c46a032] log: see above
│ │ │ │ │ │ │ ├─restricted by compatibility requirements with Reexport [189a3867] to versions: [3.2.0-5.3.0, 5.8.0-5.12.2] or uninstalled, leaving only versions: [5.0.0-5.3.0, 5.8.0-5.12.2]
│ │ │ │ │ │ │ │ └─Reexport [189a3867] log: see above
│ │ │ │ │ │ │ └─restricted by compatibility requirements with ModelingToolkit [961ee093] to versions: [3.2.0-4.2.1, 5.8.0-5.12.2] or uninstalled, leaving only versions: 5.8.0-5.12.2
│ │ │ │ │ │ │ └─ModelingToolkit [961ee093] log: see above
│ │ │ │ │ │ ├─restricted by compatibility requirements with DiffEqJump [c894b116] to versions: [0.0.1-3.1.1, 5.26.0-7.1.3] or uninstalled, leaving only versions: [1.3.0-3.1.1, 5.26.0-7.1.3]
│ │ │ │ │ │ │ └─DiffEqJump [c894b116] log:
│ │ │ │ │ │ │ ├─possible versions are: 5.0.0-8.0.0 or uninstalled
│ │ │ │ │ │ │ └─restricted by compatibility requirements with DifferentialEquations [0c46a032] to versions: 7.0.0-8.0.0
│ │ │ │ │ │ │ └─DifferentialEquations [0c46a032] log: see above
│ │ │ │ │ │ ├─restricted by compatibility requirements with UnPack [3a884ed6] to versions: [0.0.1-2.0.0, 3.2.0-7.1.3] or uninstalled, leaving only versions: [1.3.0-2.0.0, 5.26.0-7.1.3]
│ │ │ │ │ │ │ └─UnPack [3a884ed6] log:
│ │ │ │ │ │ │ ├─possible versions are: 0.1.0-1.0.2 or uninstalled
│ │ │ │ │ │ │ └─restricted by compatibility requirements with DiffEqJump [c894b116] to versions: 1.0.2
│ │ │ │ │ │ │ └─DiffEqJump [c894b116] log: see above
│ │ │ │ │ │ └─restricted by compatibility requirements with StaticArrays [90137ffa] to versions: 4.0.7-7.1.3 or uninstalled, leaving only versions: 5.26.0-7.1.3
│ │ │ │ │ │ └─StaticArrays [90137ffa] log: see above
│ │ │ │ │ ├─restricted by compatibility requirements with StochasticDiffEq [789caeaf] to versions: 0.11.0-1.2.13
│ │ │ │ │ │ └─StochasticDiffEq [789caeaf] log:
│ │ │ │ │ │ ├─possible versions are: 5.0.0-6.43.0 or uninstalled
│ │ │ │ │ │ ├─restricted by compatibility requirements with DifferentialEquations [0c46a032] to versions: 6.37.0-6.43.0
│ │ │ │ │ │ │ └─DifferentialEquations [0c46a032] log: see above
│ │ │ │ │ │ └─restricted by compatibility requirements with OrdinaryDiffEq [1dea7af3] to versions: [5.0.0-6.20.0, 6.43.0] or uninstalled, leaving only versions: 6.43.0
│ │ │ │ │ │ └─OrdinaryDiffEq [1dea7af3] log:
│ │ │ │ │ │ ├─possible versions are: 4.0.0-6.0.3 or uninstalled
│ │ │ │ │ │ └─restricted by compatibility requirements with DifferentialEquations [0c46a032] to versions: 6.0.0-6.0.3
│ │ │ │ │ │ └─DifferentialEquations [0c46a032] log: see above
│ │ │ │ │ └─restricted by compatibility requirements with DEDataArrays [754358af] to versions: 1.0.0-1.2.13
│ │ │ │ │ └─DEDataArrays [754358af] log:
│ │ │ │ │ ├─possible versions are: 0.1.0-0.2.0 or uninstalled
│ │ │ │ │ └─restricted by compatibility requirements with DiffEqBase [2b5f629d] to versions: 0.2.0
│ │ │ │ │ └─DiffEqBase [2b5f629d] log:
│ │ │ │ │ ├─possible versions are: 3.13.2-6.78.0 or uninstalled
│ │ │ │ │ ├─restricted by compatibility requirements with DifferentialEquations [0c46a032] to versions: 6.72.0-6.78.0
│ │ │ │ │ │ └─DifferentialEquations [0c46a032] log: see above
│ │ │ │ │ ├─restricted by compatibility requirements with OrdinaryDiffEq [1dea7af3] to versions: 6.75.0-6.78.0
│ │ │ │ │ │ └─OrdinaryDiffEq [1dea7af3] log: see above
│ │ │ │ │ └─restricted by compatibility requirements with PreallocationTools [d236fae5] to versions: [3.13.2-6.70.0, 6.76.0-6.78.0] or uninstalled, leaving only versions: 6.76.0-6.78.0
│ │ │ │ │ └─PreallocationTools [d236fae5] log:
│ │ │ │ │ ├─possible versions are: 0.1.0-0.2.1 or uninstalled
│ │ │ │ │ └─restricted by compatibility requirements with OrdinaryDiffEq [1dea7af3] to versions: 0.2.0-0.2.1
│ │ │ │ │ └─OrdinaryDiffEq [1dea7af3] log: see above
│ │ │ │ ├─restricted by compatibility requirements with Requires [ae029012] to versions: 0.28.4-1.25.3 or uninstalled, leaving only versions: 0.28.4-1.25.3
│ │ │ │ │ └─Requires [ae029012] log: see above
│ │ │ │ └─restricted by compatibility requirements with Reexport [189a3867] to versions: 1.10.1-1.25.3 or uninstalled, leaving only versions: 1.10.1-1.25.3
│ │ │ │ └─Reexport [189a3867] log: see above
│ │ │ └─restricted by compatibility requirements with LinearSolve [7ed4a6bd] to versions: 1.0.0-1.2.0
│ │ │ └─LinearSolve [7ed4a6bd] log: see above
│ │ └─restricted by compatibility requirements with Reexport [189a3867] to versions: 0.15.11-0.19.2 or uninstalled, leaving only versions: 0.15.11-0.19.2
│ │ └─Reexport [189a3867] log: see above
│ ├─restricted by compatibility requirements with Libtask_jll [3ae2931a] to versions: [0.1.1-0.4.2, 0.6.0-0.6.1] or uninstalled, leaving only versions: 0.1.1-0.4.2
│ │ └─Libtask_jll [3ae2931a] log:
│ │ ├─possible versions are: 0.3.0-0.5.1 or uninstalled
│ │ └─restricted by julia compatibility requirements to versions: [0.3.0-0.3.2, 0.5.0-0.5.1] or uninstalled
│ ├─restricted by compatibility requirements with Turing [fce5fe82] to versions: 0.3.1-0.5.3, leaving only versions: 0.3.1-0.4.2
│ │ └─Turing [fce5fe82] log: see above
│ └─restricted by compatibility requirements with Turing [fce5fe82] to versions: 0.4.0-0.5.3, leaving only versions: 0.4.0-0.4.2
│ └─Turing [fce5fe82] log: see above
├─restricted by compatibility requirements with Libtask [6f1fad26] to versions: uninstalled
│ └─Libtask [6f1fad26] log: see above
└─restricted by compatibility requirements with Turing [fce5fe82] to versions: 0.1.0-0.2.4 — no versions left
└─Turing [fce5fe82] log: see above
Stacktrace:
[1] propagate_constraints!(graph::Pkg.Resolve.Graph, sources::Set{Int64}; log_events::Bool)
@ Pkg.Resolve /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/Resolve/graphtype.jl:1063
[2] propagate_constraints! (repeats 2 times)
@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/Resolve/graphtype.jl:1000 [inlined]
[3] simplify_graph!(graph::Pkg.Resolve.Graph, sources::Set{Int64}; clean_graph::Bool)
@ Pkg.Resolve /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/Resolve/graphtype.jl:1519
[4] simplify_graph! (repeats 2 times)
@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/Resolve/graphtype.jl:1519 [inlined]
[5] resolve_versions!(env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, julia_version::VersionNumber)
@ Pkg.Operations /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/Operations.jl:335
[6] targeted_resolve(env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, preserve::Pkg.Types.PreserveLevel, julia_version::VersionNumber)
@ Pkg.Operations /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/Operations.jl:1154
[7] tiered_resolve(env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, julia_version::VersionNumber)
@ Pkg.Operations /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/Operations.jl:1139
[8] _resolve(io::Base.TTY, env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, preserve::Pkg.Types.PreserveLevel, julia_version::VersionNumber)
@ Pkg.Operations /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/Operations.jl:1160
[9] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}, new_git::Set{Base.UUID}; preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform)
Installed DelayDiffEq ──────────────── v5.31.0
Installed Setfield ─────────────────── v0.7.1
Installed ChainRulesCore ───────────── v0.9.45
Installed ArrayInterface ───────────── v2.14.17
Installed Reexport ─────────────────── v0.2.0
Installed RangeArrays ──────────────── v0.3.2
Installed TerminalLoggers ──────────── v0.1.5
Installed LogExpFunctions ──────────── v0.3.0
Installed ExponentialUtilities ─────── v1.8.2
Installed ScientificTypesBase ──────── v2.3.0
Installed AdvancedHMC ──────────────── v0.2.27
Installed MLJModelInterface ────────── v1.3.3
Installed VectorizationBase ────────── v0.16.2
Installed Hwloc ────────────────────── v1.3.0
Installed PrettyTables ─────────────── v1.3.1
Installed LightGraphs ──────────────── v1.3.5
Installed FillArrays ───────────────── v0.11.9
Installed Interpolations ───────────── v0.13.2
Installed RecursiveFactorization ───── v0.1.13
Installed FastBroadcast ────────────── v0.1.8
Installed LogDensityProblems ───────── v0.10.6
Installed Distributions ────────────── v0.24.18
Installed SymbolicUtils ────────────── v0.13.2
Installed LoopVectorization ────────── v0.10.0
Updating `~/Julia/workspace/odes/Project.toml`
[0c46a032] ↓ DifferentialEquations v6.21.0 ⇒ v6.18.0
[31c24e10] ↓ Distributions v0.25.37 ⇒ v0.24.18
[fce5fe82] + Turing v0.15.1
Updating `~/Julia/workspace/odes/Manifest.toml`
[621f4979] + AbstractFFTs v1.0.1
[80f14c24] + AbstractMCMC v2.5.0
[7a57a42e] + AbstractPPL v0.1.4
[0bf59076] + AdvancedHMC v0.2.27
[5b7e9947] + AdvancedMH v0.5.9
[b5ca4192] + AdvancedVI v0.1.3
[ec485272] ↓ ArnoldiMethod v0.2.0 ⇒ v0.1.0
[4fba245c] ↓ ArrayInterface v3.2.1 ⇒ v2.14.17
[4c555306] ↓ ArrayLayouts v0.7.8 ⇒ v0.7.5
[15f4f7f2] - AutoHashEquals v0.2.0
[13072b0f] + AxisAlgorithms v1.0.1
[39de3d68] + AxisArrays v0.4.4
[6e4b80f9] + BenchmarkTools v0.7.0
[e2ed5e7c] - Bijections v0.1.3
[76274a88] + Bijectors v0.8.16
[b99e7846] + BinaryProvider v0.5.10
[62783981] - BitTwiddlingConvenienceFunctions v0.1.1
[2a0fbf3d] - CPUSummary v0.1.6
[082447d4] + ChainRules v0.7.70
[d360d2e6] ↓ ChainRulesCore v1.11.2 ⇒ v0.9.45
[9e997f8a] - ChangesOfVariables v0.1.2
[fb6a15b2] - CloseOpenIntervals v0.1.4
[88cd18e8] + ConsoleProgressMonitor v0.1.2
[754358af] - DEDataArrays v0.2.0
[bcd4f6db] ↓ DelayDiffEq v5.32.3 ⇒ v5.31.0
[b429d917] - DensityInterface v0.4.0
[2b5f629d] ↓ DiffEqBase v6.78.0 ⇒ v6.69.1
[459566f4] ↓ DiffEqCallbacks v2.19.0 ⇒ v2.17.0
[c894b116] ↓ DiffEqJump v8.0.0 ⇒ v7.3.1
[b552c78f] ↓ DiffRules v1.9.0 ⇒ v1.5.0
[0c46a032] ↓ DifferentialEquations v6.21.0 ⇒ v6.18.0
[31c24e10] ↓ Distributions v0.25.37 ⇒ v0.24.18
[ced4e74d] + DistributionsAD v0.6.29
[366bfd00] + DynamicPPL v0.10.20
[7c1d4256] ↓ DynamicPolynomials v0.4.1 ⇒ v0.3.3
[da5c29d0] ↓ EllipsisNotation v1.1.3 ⇒ v1.0.0
[cad2338a] + EllipticalSliceSampling v0.3.1
[d4d017d3] ↓ ExponentialUtilities v1.10.2 ⇒ v1.8.2
[7a1cc6ca] + FFTW v1.4.5
[7034ab61] ↓ FastBroadcast v0.1.11 ⇒ v0.1.8
[1a297f60] ↓ FillArrays v0.12.7 ⇒ v0.11.9
[d9f16b24] + Functors v0.1.0
[3e5b6fbb] - HostCPUFeatures v0.1.5
[0e44f5e4] ↓ Hwloc v2.0.0 ⇒ v1.3.0
[505f98c9] + InplaceOps v0.3.0
[a98d9a8b] + Interpolations v0.13.2
[3587e190] - InverseFunctions v0.1.2
[41ab1584] + InvertedIndices v1.1.0
[c8e1da08] + IterTools v1.4.0
[98e50ef6] ↓ JuliaFormatter v0.19.2 ⇒ v0.15.11
[ef3ab10e] - KLU v0.2.3
[5ab0869b] + KernelDensity v0.6.3
[ba0b0d4f] - Krylov v0.7.9
[0b1a1467] - KrylovKit v0.5.3
[2ee39098] ↓ LabelledArrays v1.6.7 ⇒ v1.6.6
[10f19ff3] - LayoutPointers v0.1.4
[1d6d02ad] + LeftChildRightSiblingTrees v0.1.3
[6f1fad26] + Libtask v0.4.2
[093fc24a] + LightGraphs v1.3.5
[7ed4a6bd] - LinearSolve v1.1.2
[6fdf6af0] + LogDensityProblems v0.10.6
[2ab3a3ac] ↓ LogExpFunctions v0.3.6 ⇒ v0.3.0
[e6f89c97] + LoggingExtras v0.4.7
[bdcacae8] ↓ LoopVectorization v0.12.99 ⇒ v0.10.0
[c7f686f2] + MCMCChains v4.14.1
[e80e1ace] + MLJModelInterface v1.3.3
[d125e4d3] - ManualMemory v0.1.6
[dbb5928d] + MappedArrays v0.4.1
[e9d8d322] - Metatheory v1.3.2
[961ee093] ↓ ModelingToolkit v7.1.3 ⇒ v6.4.7
[102ac46a] ↓ MultivariatePolynomials v0.4.2 ⇒ v0.3.2
[d8a4904e] - MutableArithmetics v0.3.1
[872c559c] + NNlib v0.7.31
[86f7a689] + NamedArrays v0.9.6
[c020b1a1] + NaturalSort v1.0.0
[1dea7af3] ↓ OrdinaryDiffEq v6.0.3 ⇒ v5.55.1
[65888b18] ↓ ParameterizedFunctions v5.12.2 ⇒ v5.12.1
[f517fe37] - Polyester v0.5.4
[1d0040c9] - PolyesterWeave v0.1.2
[d236fae5] - PreallocationTools v0.2.1
[08abe8d2] + PrettyTables v1.3.1
[33c8b6b6] + ProgressLogging v0.1.4
[92933f4c] + ProgressMeter v1.7.1
[b3c3ace0] + RangeArrays v0.3.2
[c84ed2f1] + Ratios v0.4.2
[731186ca] ↓ RecursiveArrayTools v2.20.0 ⇒ v2.11.4
[f2c3362d] ↓ RecursiveFactorization v0.2.5 ⇒ v0.1.13
[189a3867] ↓ Reexport v1.2.2 ⇒ v0.2.0
[42d2dcc6] - Referenceables v0.1.2
[3cdde19b] - SIMDDualNumbers v0.1.0
[94e857df] - SIMDTypes v0.1.0
[476501e8] ↓ SLEEFPirates v0.6.28 ⇒ v0.6.8
[0bca4576] ↓ SciMLBase v1.23.1 ⇒ v1.13.6
[30f210dd] + ScientificTypesBase v2.3.0
[276daf66] ↓ SpecialFunctions v1.8.1 ⇒ v0.10.3
[aedffcd0] - Static v0.4.1
[64bff920] + StatisticalTraits v2.1.0
[4c63d2b9] ↓ StatsFuns v0.9.14 ⇒ v0.9.7
[789caeaf] ↓ StochasticDiffEq v6.43.0 ⇒ v6.40.0
[7792a7ef] - StrideArraysCore v0.2.9
[d1185830] ↓ SymbolicUtils v0.18.2 ⇒ v0.13.2
[0c5d862f] ↓ Symbolics v4.2.0 ⇒ v3.2.3
[8ea1fca8] - TermInterface v0.2.3
[5d786b92] + TerminalLoggers v0.1.5
[8290d209] ↓ ThreadingUtilities v0.4.6 ⇒ v0.2.3
[ac1d9e8a] - ThreadsX v0.1.8
[9f7883ad] + Tracker v0.2.16
[84d833dd] + TransformVariables v0.4.1
[d5829a12] - TriangularSolve v0.1.8
[fce5fe82] + Turing v0.15.1
[3d5dd08c] ↓ VectorizationBase v0.21.23 ⇒ v0.16.2
[efce3f68] + WoodburyMatrices v0.5.5
[f5851436] + FFTW_jll v3.3.10+0
[1d5cc7b8] + IntelOpenMP_jll v2018.0.3+2
[856f044c] + MKL_jll v2021.1.1+2
[4af54fe1] + LazyArtifacts
[05823500] - OpenLibm_jll
Building Libtask → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/83e082fccb4e37d93df6440cdbd41dcbe5e46cb6/build.log`
Precompiling project...
100 dependencies successfully precompiled in 149 seconds (94 already precompiled)
And problems with MCMCChain
too.
julia> Pkg.add("MCMCChain")
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package MCMCChain [1671dc4f]:
MCMCChain [1671dc4f] log:
├─possible versions are: 0.1.0-0.2.3 or uninstalled
├─restricted to versions * by an explicit requirement, leaving only versions 0.1.0-0.2.3
└─restricted by julia compatibility requirements to versions: uninstalled — no versions left
Stacktrace:
[1] propagate_constraints!(graph::Pkg.Resolve.Graph, sources::Set{Int64}; log_events::Bool)
@ Pkg.Resolve /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/Resolve/graphtype.jl:1063
[2] propagate_constraints! (repeats 2 times)
@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/Resolve/graphtype.jl:1000 [inlined]
[3] simplify_graph!(graph::Pkg.Resolve.Graph, sources::Set{Int64}; clean_graph::Bool)
@ Pkg.Resolve /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/Resolve/graphtype.jl:1519
[4] simplify_graph! (repeats 2 times)
@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/Resolve/graphtype.jl:1519 [inlined]
[5] resolve_versions!(env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, julia_version::VersionNumber)
@ Pkg.Operations /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/Operations.jl:335
[6] targeted_resolve(env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, preserve::Pkg.Types.PreserveLevel, julia_version::VersionNumber)
@ Pkg.Operations /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/Operations.jl:1154
[7] tiered_resolve(env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, julia_version::VersionNumber)
@ Pkg.Operations /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/Operations.jl:1139
[8] _resolve(io::Base.TTY, env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, preserve::Pkg.Types.PreserveLevel, julia_version::VersionNumber)
@ Pkg.Operations /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/Operations.jl:1160
[9] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}, new_git::Set{Base.UUID}; preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform)
@ Pkg.Operations /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/Operations.jl:1176
[10] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform, kwargs::Base.Pairs{Symbol, Base.TTY, Tuple{Symbol}, NamedTuple{(:io,), Tuple{Base.TTY}}})
@ Pkg.API /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/API.jl:268
[11] add(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Pkg.API /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/API.jl:149
[12] add(pkgs::Vector{Pkg.Types.PackageSpec})
@ Pkg.API /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/API.jl:144
[13] #add#27
@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/API.jl:142 [inlined]
[14] add
@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/API.jl:142 [inlined]
[15] #add#26
@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/API.jl:141 [inlined]
[16] add(pkg::String)
@ Pkg.API /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Pkg/src/API.jl:141
[17] top-level scope
@ REPL[7]:1
I don’t know. but if you want Chris to be able to help you, you should gather as much information as possible, e.g. OS and versions of the packages you are running. So far I’m able to run the tutorial, except the parts involving MCMCChains
, which I cannot even install. For convenience, I have copied the code (next time, instead of screenshots, copy-paste the code to make it easier for others). Which part of the following code doesn’t run for you?
dir = expanduser("~/Julia/workspace/odes")
push!(LOAD_PATH, dir)
import Pkg
Pkg.activate(dir)
Base.active_project()
# using Pkg; Pkg.add(["DifferentialEquations", "Turing", "Plots", "StatsPlots"])
# Pkg.add(["Zygote", "DiffEqSensitivity"])
"""
# https://github.com/TuringLang/TuringTutorials.
To locally run this tutorial, do the following commands:
using TuringTutorials
TuringTutorials.weave_file("10-bayesian-differential-equations", "10_bayesian-differential-equations.jmd")
"""
using Distributions
using DifferentialEquations
using Turing
# using MCMCChains
using Plots, StatsPlots
# Set a seed for reproducibility.
using Random
Random.seed!(14);
function lotka_volterra(du,u,p,t)
x, y = u
α, β, γ, δ = p
du[1] = (α - β*y)x # dx =
du[2] = (δ*x - γ)y # dy =
end
p = [1.5, 1.0, 3.0, 1.0]
u0 = [1.0,1.0]
prob1 = ODEProblem(lotka_volterra,u0,(0.0,10.0),p)
sol = solve(prob1,Tsit5())
plot(sol)
sol1 = solve(prob1,Tsit5(),saveat=0.1)
odedata = Array(sol1) + 0.8 * randn(size(Array(sol1)))
plot(sol1, alpha = 0.3, legend = false); scatter!(sol1.t, odedata')
# Direct Handling of Bayesian Estimation with Turing
# Turing and DifferentialEquations are completely composable and we can write of the differential equation inside a Turing @model
Turing.setadbackend(:forwarddiff)
@model function fitlv(data, prob1)
σ ~ InverseGamma(2, 3) # ~ is the tilde character
α ~ truncated(Normal(1.5,0.5),0.5,2.5)
β ~ truncated(Normal(1.2,0.5),0,2)
γ ~ truncated(Normal(3.0,0.5),1,4)
δ ~ truncated(Normal(1.0,0.5),0,2)
p = [α,β,γ,δ]
prob = remake(prob1, p=p)
predicted = solve(prob,Tsit5(),saveat=0.1)
for i = 1:length(predicted)
data[:,i] ~ MvNormal(predicted[i], σ)
end
end
model = fitlv(odedata, prob1)
# This next command runs 3 independent chains without using multithreading.
chain = mapreduce(c -> sample(model, NUTS(.65),1000), chainscat, 1:3)
plot(chain)
# Data retrodiction
# Retrodiction: generate simulated data using samples from the posterior distribution, and compare to the original data.
pl = scatter(sol1.t, odedata');
chain_array = Array(chain)
for k in 1:300
resol = solve(remake(prob1,p=chain_array[rand(1:1500), 1:4]),Tsit5(),saveat=0.1)
plot!(resol, alpha=0.1, color = "#BBBBBB", legend = false)
end
# display(pl)
plot!(sol1, w=1, legend = false)
# Lokta Volterra with missing predator data
@model function fitlv2(data, prob1) # data should be a Vector
σ ~ InverseGamma(2, 3) # ~ is the tilde character
α ~ truncated(Normal(1.5,0.5),0.5,2.5)
β ~ truncated(Normal(1.2,0.5),0,2)
γ ~ truncated(Normal(3.0,0.5),1,4)
δ ~ truncated(Normal(1.0,0.5),0,2)
p = [α,β,γ,δ]
prob = remake(prob1, p=p)
predicted = solve(prob,Tsit5(),saveat=0.1)
for i = 1:length(predicted)
data[i] ~ Normal(predicted[i][2], σ) # predicted[i][2] is the data for y - a scalar, so we use Normal instead of MvNormal
end
end
model2 = fitlv2(odedata[2,:], prob1)
# multithreading to sample 3 independent chains
Threads.nthreads()
# This next command runs 3 independent chains with multithreading.
chain2 = sample(model2, NUTS(.45), MCMCThreads(), 5000, 3, progress=false)
pl = scatter(sol1.t, odedata');
chain_array2 = Array(chain2)
for k in 1:300
resol = solve(remake(prob1,p=chain_array2[rand(1:12000), 1:4]),Tsit5(),saveat=0.1)
# Note that due to a bug in AxisArray, the variables from the chain will be returned always in
# the order it is stored in the array, not by the specified order in the call - :α, :β, :γ, :δ
plot!(resol, alpha=0.1, color = "#BBBBBB", legend = false)
end
#display(pl)
plot!(sol1, w=1, legend = false)
# Inference of Delay Differential Equations
function delay_lotka_volterra(du, u, h, p, t)
x, y = u
α, β, γ, δ = p
du[1] = α * h(p, t-1; idxs=1) - β * x * y
du[2] = -γ * y + δ * x * y
return
end
p = (1.5,1.0,3.0,1.0)
u0 = [1.0; 1.0]
tspan = (0.0,10.0)
h(p, t; idxs::Int) = 1.0
prob1 = DDEProblem(delay_lotka_volterra,u0,h,tspan,p)
sol = solve(prob1,saveat=0.1)
ddedata = Array(sol)
ddedata = ddedata + 0.5 * randn(size(ddedata))
scatter(sol.t, ddedata'); plot!(sol)
# Now we define and run the Turing model.
Turing.setadbackend(:forwarddiff)
@model function fitlv(data, prob1)
σ ~ InverseGamma(2, 3)
α ~ Truncated(Normal(1.5,0.5),0.5,2.5)
β ~ Truncated(Normal(1.2,0.5),0,2)
γ ~ Truncated(Normal(3.0,0.5),1,4)
δ ~ Truncated(Normal(1.0,0.5),0,2)
p = [α,β,γ,δ]
#prob = DDEProblem(delay_lotka_volterra,u0,_h,tspan,p)
prob = remake(prob1, p=p)
predicted = solve(prob,saveat=0.1)
for i = 1:length(predicted)
data[:,i] ~ MvNormal(predicted[i], σ)
end
end;
model = fitlv(ddedata, prob1)
# Draw samples using multithreading
chain = sample(model, NUTS(.65), MCMCThreads(), 300, 3, progress=true)
plot(chain)
pl = scatter(sol.t, ddedata')
chain_array = Array(chain)
for k in 1:100
resol = solve(remake(prob1,p=chain_array[rand(1:450),1:4]),Tsit5(),saveat=0.1)
# Note that due to a bug in AxisArray, the variables from the chain will be returned always in
# the order it is stored in the array, not by the specified order in the call - :α, :β, :γ, :δ
plot!(resol, alpha=0.1, color = "#BBBBBB", legend = false)
end
#display(pl)
plot!(sol)
using Zygote, DiffEqSensitivity
Turing.setadbackend(:zygote)
prob1 = ODEProblem(lotka_volterra,u0,(0.0,10.0),p)
@model function fitlv(data, prob)
σ ~ InverseGamma(2, 3)
α ~ truncated(Normal(1.5,0.5),0.5,2.5)
β ~ truncated(Normal(1.2,0.5),0,2)
γ ~ truncated(Normal(3.0,0.5),1,4)
δ ~ truncated(Normal(1.0,0.5),0,2)
p = [α,β,γ,δ]
prob = remake(prob, p=p)
predicted = solve(prob,saveat=0.1)
for i = 1:length(predicted)
data[:,i] ~ MvNormal(predicted[i], σ)
end
end;
model = fitlv(odedata, prob1)
chain = sample(model, NUTS(.65),1000)
@model function fitlv(data, prob)
σ ~ InverseGamma(2, 3)
α ~ truncated(Normal(1.5,0.5),0.5,2.5)
β ~ truncated(Normal(1.2,0.5),0,2)
γ ~ truncated(Normal(3.0,0.5),1,4)
δ ~ truncated(Normal(1.0,0.5),0,2)
p = [α,β,γ,δ]
prob = remake(prob, p=p)
predicted = solve(prob,saveat=0.1,sensealg=InterpolatingAdjoint(autojacvec=ReverseDiffVJP(true)))
for i = 1:length(predicted)
data[:,i] ~ MvNormal(predicted[i], σ)
end
end;
model = fitlv(odedata, prob1)
@time chain = sample(model, NUTS(.65),1000)
# Inference of a Stochastic Differential Equation
u0 = [1.0,1.0]
tspan = (0.0,10.0)
function multiplicative_noise!(du,u,p,t)
x,y = u
du[1] = p[5]*x
du[2] = p[6]*y
end
p = [1.5,1.0,3.0,1.0,0.1,0.1]
function lotka_volterra!(du,u,p,t)
x,y = u
α,β,γ,δ = p
du[1] = dx = α*x - β*x*y
du[2] = dy = δ*x*y - γ*y
end
prob_sde = SDEProblem(lotka_volterra!,multiplicative_noise!,u0,tspan,p)
ensembleprob = EnsembleProblem(prob_sde)
@time data = solve(ensembleprob,SOSRI(),saveat=0.1,trajectories=1000)
plot(EnsembleSummary(data))
Turing.setadbackend(:forwarddiff)
@model function fitlv(data, prob)
σ ~ InverseGamma(2,3)
α ~ truncated(Normal(1.3,0.5),0.5,2.5)
β ~ truncated(Normal(1.2,0.25),0.5,2)
γ ~ truncated(Normal(3.2,0.25),2.2,4.0)
δ ~ truncated(Normal(1.2,0.25),0.5,2.0)
ϕ1 ~ truncated(Normal(0.12,0.3),0.05,0.25)
ϕ2 ~ truncated(Normal(0.12,0.3),0.05,0.25)
p = [α,β,γ,δ,ϕ1,ϕ2]
prob = remake(prob, p=p)
predicted = solve(prob,SOSRI(),saveat=0.1)
if predicted.retcode != :Success
Turing.acclogp!(_varinfo, -Inf)
end
for j in 1:length(data)
for i = 1:length(predicted)
data[j][i] ~ MvNormal(predicted[i],σ)
end
end
end;
model = fitlv(data, prob_sde)
chain = sample(model, NUTS(0.25), 5000, init_theta = [1.5,1.3,1.2,2.7,1.2,0.12,0.12])
plot(chain)
Turing is not compatible with Julia 1.7, you need to use 1.6.5
That error looks like it’s from having data the wrong size. There’s a spot in the tutorial where data might get redefined that wasn’t ran on your side or something. I can’t quite run it right now very easily because of this whole v1.7 issue.
thanks for your advise.
The error appears in the last part of the code you showed. I also ran the code you posted, and it still got the same error.
model = fitlv(data, prob_sde)
chain = sample(model, NUTS(0.25), 5000, init_theta = [1.5,1.3,1.2,2.7,1.2,0.12,0.12])
plot(chain) #Error when running here
@model function fitlv(data, prob)
σ ~ InverseGamma(2,3)
α ~ truncated(Normal(1.3,0.5),0.5,2.5)
β ~ truncated(Normal(1.2,0.25),0.5,2)
γ ~ truncated(Normal(3.2,0.25),2.2,4.0)
δ ~ truncated(Normal(1.2,0.25),0.5,2.0)
ϕ1 ~ truncated(Normal(0.12,0.3),0.05,0.25)
ϕ2 ~ truncated(Normal(0.12,0.3),0.05,0.25)
p = [α,β,γ,δ,ϕ1,ϕ2]
prob = remake(prob, p=p)
predicted = solve(prob,SOSRI(),saveat=0.1)
if predicted.retcode != :Success
Turing.acclogp!(_varinfo, -Inf)
end
for j in 1:length(data)
for i = 1:length(predicted)
data[j][i] ~ MvNormal(predicted[i],σ)
end
end
end; #But actually there is a problem here
This is the code I am running,
using Turing, Distributions, DifferentialEquations
# Import MCMCChain, Plots, and StatsPlots for visualizations and diagnostics.
using MCMCChains, Plots, StatsPlots
# Set a seed for reproducibility.
using Random
Random.seed!(14);
u0 = [1.0,1.0]
tspan = (0.0,10.0)
function multiplicative_noise!(du,u,p,t)
x,y = u
du[1] = p[5]*x
du[2] = p[6]*y
end
p = [1.5,1.0,3.0,1.0,0.1,0.1]
function lotka_volterra!(du,u,p,t)
x,y = u
α,β,γ,δ = p
du[1] = dx = α*x - β*x*y
du[2] = dy = δ*x*y - γ*y
end
prob_sde = SDEProblem(lotka_volterra!,multiplicative_noise!,u0,tspan,p)
ensembleprob = EnsembleProblem(prob_sde)
@time data = solve(ensembleprob,SOSRI(),saveat=0.1,trajectories=1000)
plot(EnsembleSummary(data))
Turing.setadbackend(:forwarddiff)
@model function fitlv(data, prob)
σ ~ InverseGamma(2,3)
α ~ truncated(Normal(1.3,0.5),0.5,2.5)
β ~ truncated(Normal(1.2,0.25),0.5,2)
γ ~ truncated(Normal(3.2,0.25),2.2,4.0)
δ ~ truncated(Normal(1.2,0.25),0.5,2.0)
ϕ1 ~ truncated(Normal(0.12,0.3),0.05,0.25)
ϕ2 ~ truncated(Normal(0.12,0.3),0.05,0.25)
p = [α,β,γ,δ,ϕ1,ϕ2]
prob = remake(prob, p=p)
predicted = solve(prob,SOSRI(),saveat=0.1)
if predicted.retcode != :Success
Turing.acclogp!(_varinfo, -Inf)
end
for j in 1:length(data)
for i = 1:length(predicted)
data[j][i] ~ MvNormal(predicted[i],σ)
end
end
end;
model = fitlv(data, prob_sde)
chain = sample(model, NUTS(0.25), 5000, init_theta = [1.5,1.3,1.2,2.7,1.2,0.12,0.12])
plot(chain)
The version I am using is 1.6.1. Will this be compatible with Turing?
The version I am using is 1.6.1. Will this be compatible with Turing? I’m not sure
Can you not update to 1.6.5?
1.6.1 should be fine, although 1.6.5 is preferred (as a patch release it should be a drop-in replacement and not affect the error you’re seeing here).
Just make sure you’re on the latest releases of the packages you’re using
I mean ,this is not a version issue, I just tried 1.6.5 and still have this error
ok,thank you so much
The section below Inference of a Stochastic Differential Equation runs fine for me on v1.7
. I get the 14-plot panel. But it does take several minutes to run.
I tried version 1.6.3 and still have this problem. I will try to upgrade 1.7, thank you for your help
v1.7
won’t be the right version for Turing
yet, you’ll need to wait a few bug fixes and an update to the package. The piece of code you copy-pasted cannot be run as is (is it the section below Inference of a Stochastic Differential Equation?) perhaps you’ve inadvertently changed something to the original code? The error you report is surprising if you’re running the part of the code I refer to.
I did not make changes to the code. Actually, the code I changed had the same problem first, so I copied the code of the tutorials, but it also had the same problem. Not only me, I asked my classmates to run the same code. The same problem occurred.
Are you on older package versions?