# Error with ode\_def

**URL:** https://discourse.julialang.org/t/error-with-ode-def/18594
**Category:** New to Julia
**Tags:** question
**Created:** [December 12, 2018, 1:41pm UTC](https://discourse.julialang.org/t/error-with-ode-def/18594 "2018-12-12T13:41:18Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![Stephen](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@Stephen](https://discourse.julialang.org/u/Stephen)
#### Post date: [December 12, 2018, 1:41pm UTC](https://discourse.julialang.org/t/error-with-ode-def/18594/1 "2018-12-12T13:41:18Z")

</div>

```julia
using DifferentialEquations
f = @ode_def LotkaVolterra begin
  dx = a*x - b*x*y
  dy = -c*y + d*x*y
end a b c d

```

produce

```julia
ERROR: LoadError: LoadError: error compiling #ode_def_opts#1: error compiling symbols: error compiling _symbol: could not load library "libsymengine"
libsymengine.so: 无法打开共享对象文件: 没有那个文件或目录
Stacktrace:
 [1] ode_def_opts(::Symbol, ::Dict{Symbol,Bool}, ::Expr, ::Symbol, ::Vararg{Symbol,N} where N) at /home/rzhli/.julia/packages/ParameterizedFunctions/ozDxQ/src/ode_def_opts.jl:5
 [2] @ode_def(::LineNumberNode, ::Module, ::Any, ::Any, ::Vararg{Any,N} where N) at /home/rzhli/.julia/packages/ParameterizedFunctions/ozDxQ/src/macros.jl:11
in expression starting at untitled-eeb77f88afbc35d3ef7092e6a7f41371:2
in expression starting at untitled-eeb77f88afbc35d3ef7092e6a7f41371:2

```

---

<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: [December 12, 2018, 3:37pm UTC](https://discourse.julialang.org/t/error-with-ode-def/18594/2 "2018-12-12T15:37:58Z")

</div>

What does `]build SymEngine` give you?

---

<div class="post-metadata">

### Author: ![Stephen](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@Stephen](https://discourse.julialang.org/u/Stephen)
#### Post date: [December 13, 2018, 1:29am UTC](https://discourse.julialang.org/t/error-with-ode-def/18594/3 "2018-12-13T01:29:21Z")

</div>

> [@ChrisRackauckas](#):
>
> build SymEngine

oh, Hash Mismatch, what should I do?

```julia
Error: Error building `SymEngine`:
│ ERROR: LoadError: Hash Mismatch!
│ Expected sha256: 40f3d06abf45b571b23135a079d66827282e587be15d540874bb45dac163e2c7
│ Calculated sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
│ Stacktrace:
│ [1] error(::String) at ./error.jl:33
│ [2] (::getfield(BinaryProvider, Symbol("##141#143")){Bool,String,String,String})(::IOStream) at /home/rzhli/.julia/packages/BinaryProvider/4F5Hq/src/Prefix.jl:571
│ [3] #open#294(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::getfield(BinaryProvider, Symbol("##141#143")){Bool,String,String,String}, ::String) at ./iostream.jl:369
│ [4] open at ./iostream.jl:367 [inlined]
│ [5] #verify#140(::Bool, ::Bool, ::String, ::Function, ::String, ::String) at /home/rzhli/.julia/packages/BinaryProvider/4F5Hq/src/Prefix.jl:557
│ [6] #verify at ./none:0 [inlined]
│ [7] #download_verify#90(::Bool, ::Bool, ::Bool, ::Function, ::String, ::String, ::String) at /home/rzhli/.julia/packages/BinaryProvider/4F5Hq/src/PlatformEngines.jl:543
│ [8] download_verify(::String, ::String, ::String) at /home/rzhli/.julia/packages/BinaryProvider/4F5Hq/src/PlatformEngines.jl:528
│ [9] top-level scope at /home/rzhli/.julia/packages/SymEngine/sh7Yz/deps/build.jl:23
│ [10] include at ./boot.jl:317 [inlined]
│ [11] include_relative(::Module, ::String) at ./loading.jl:1044
│ [12] include(::Module, ::String) at ./sysimg.jl:29
│ [13] include(::String) at ./client.jl:392
│ [14] top-level scope at none:0
│ in expression starting at /home/rzhli/.julia/packages/SymEngine/sh7Yz/deps/build.jl:21
└ @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1097

```

---

<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: [December 13, 2018, 4:36am UTC](https://discourse.julialang.org/t/error-with-ode-def/18594/4 "2018-12-13T04:36:57Z")

</div>

If you delete the binary from `.julia/packages/SymEngine` it should try to re-download and get you the new one. I assume you might’ve changed versions or something. I’m not sure what happened but something wrong happening with the download/install of that binary.

---

<div class="post-metadata">

### Author: ![Stephen](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@Stephen](https://discourse.julialang.org/u/Stephen)
#### Post date: [December 13, 2018, 11:12am UTC](https://discourse.julialang.org/t/error-with-ode-def/18594/5 "2018-12-13T11:12:11Z")

</div>

I followed your instruction and re-build SymEngine, but it gives new error:

```julia
Updating registry at `~/.julia/registries/General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
 Installed SymEngine ─ v0.4.3
  Building SymEngine → `~/.julia/packages/SymEngine/sh7Yz/deps/build.log`
┌ Error: Error building `SymEngine`:
│ [ Info: Downloading https://github.com/JuliaMath/MPFRBuilder/releases/download/v4.0.1-3/build_MPFR.v4.0.1.jl to /home/rzhli/.julia/packages/SymEngine/sh7Yz/deps/symengine-0.3/downloads/build_40f3d06abf45b571b23135a079d66827282e587be15d540874bb45dac163e2c7.jl...
│ ┌ Warning: platform_key() is deprecated, use platform_key_abi() from now on
│ │ caller = ip:0x0
│ └ @ Core :-1
│ [ Info: Downloading https://github.com/JuliaMath/MPFRBuilder/releases/download/v4.0.1-3/MPFR.v4.0.1.x86_64-linux-gnu.tar.gz to /home/rzhli/.julia/packages/SymEngine/sh7Yz/deps/symengine-0.3/downloads/MPFR.v4.0.1.x86_64-linux-gnu.tar.gz...
│ ERROR: LoadError: LoadError: Could not download https://github.com/JuliaMath/MPFRBuilder/releases/download/v4.0.1-3/MPFR.v4.0.1.x86_64-linux-gnu.tar.gz to /home/rzhli/.julia/packages/SymEngine/sh7Yz/deps/symengine-0.3/downloads/MPFR.v4.0.1.x86_64-linux-gnu.tar.gz:
ErrorException("")
│ Stacktrace:
│ [1] error(::String) at ./error.jl:33
│ [2] macro expansion at ./logging.jl:311 [inlined]
│ [3] #download#89(::Bool, ::Function, ::String, ::String) at /home/rzhli/.julia/packages/BinaryProvider/4F5Hq/src/PlatformEngines.jl:487
│ [4] #download at ./none:0 [inlined]
│ [5] #download_verify#90(::Bool, ::Bool, ::Bool, ::Function, ::String, ::String, ::String) at /home/rzhli/.julia/packages/BinaryProvider/4F5Hq/src/PlatformEngines.jl:567
│ [6] #download_verify at ./tuple.jl:0 [inlined]
│ [7] #install#129(::Prefix, ::String, ::Bool, ::Bool, ::Bool, ::Function, ::String, ::String) at /home/rzhli/.julia/packages/BinaryProvider/4F5Hq/src/Prefix.jl:314

```

…  
there is more error message, but actually the file has been downloaded in `/home/rzhli/.julia/packages/SymEngine/sh7Yz/deps/symengine-0.3/downloads/`

---

<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: [December 13, 2018, 11:06pm UTC](https://discourse.julialang.org/t/error-with-ode-def/18594/6 "2018-12-13T23:06:57Z")

</div>

This was fixed by [https://github.com/symengine/SymEngine.jl/pull/150](https://github.com/symengine/SymEngine.jl/pull/150) , but master hasn’t been released yet. Could you open an issue on their repo asking for them to tag an update?

---

<div class="post-metadata">

### Author: ![Stephen](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@Stephen](https://discourse.julialang.org/u/Stephen)
#### Post date: [December 15, 2018, 4:58am UTC](https://discourse.julialang.org/t/error-with-ode-def/18594/7 "2018-12-15T04:58:49Z")

</div>

I’m new to github, I’m learning how to use it. Anyway, thank you so much

---

<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: [December 15, 2018, 5:19am UTC](https://discourse.julialang.org/t/error-with-ode-def/18594/8 "2018-12-15T05:19:39Z")

</div>

No problems, let me know if you need more explanation on any of that.

---

<div class="post-metadata">

### Author: ![Stephen](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@Stephen](https://discourse.julialang.org/u/Stephen)
#### Post date: [December 16, 2018, 4:18am UTC](https://discourse.julialang.org/t/error-with-ode-def/18594/9 "2018-12-16T04:18:28Z")

</div>

problem solved since the SymEngine has been updated  
👍

---

<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: [December 16, 2018, 4:30am UTC](https://discourse.julialang.org/t/error-with-ode-def/18594/10 "2018-12-16T04:30:00Z")

</div>

Great! Glad it worked.

---

<div class="post-metadata">

### Author: ![Tilstandsrommet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tilstandsrommet/32/7928_2.png) [@Tilstandsrommet](https://discourse.julialang.org/u/Tilstandsrommet)
#### Post date: [July 16, 2019, 10:29am UTC](https://discourse.julialang.org/t/error-with-ode-def/18594/11 "2019-07-16T10:29:48Z")

</div>

I got a very similar Error today doing the same LotkaVolterra example:

```julia
error compiling _symbol: could not load library "symengine"

```

---

<div class="post-metadata">

### Author: ![Tilstandsrommet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tilstandsrommet/32/7928_2.png) [@Tilstandsrommet](https://discourse.julialang.org/u/Tilstandsrommet)
#### Post date: [July 17, 2019, 6:51am UTC](https://discourse.julialang.org/t/error-with-ode-def/18594/12 "2019-07-17T06:51:37Z")

</div>

`a = symbols("a")` produces the same error, so I guess there is something wrong with SymEngine.jl. Opened [issue #168](https://github.com/symengine/SymEngine.jl/issues/168)

---

<div class="post-metadata">

### Author: ![sbacelar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sbacelar/32/4359_2.png) [@sbacelar](https://discourse.julialang.org/u/sbacelar)
#### Post date: [July 20, 2019, 7:51pm UTC](https://discourse.julialang.org/t/error-with-ode-def/18594/13 "2019-07-20T19:51:49Z")

</div>

I have a similar error:

```julia
error compiling #ode_def_opts#1: error compiling symbols: error compiling _symbol: could not load library "libsymengine"
dlopen(libsymengine.dylib, 1): image not found

Stacktrace:
 [1] ode_def_opts(::Symbol, ::Dict{Symbol,Bool}, ::Expr, ::Symbol, ::Vararg{Symbol,N} where N) at /Users/sergiobacelar/.julia/packages/ParameterizedFunctions/1K9v5/src/ode_def_opts.jl:5
 [2] @ode_def(::LineNumberNode, ::Module, ::Any, ::Any, ::Vararg{Any,N} where N) at /Users/sergiobacelar/.julia/packages/ParameterizedFunctions/1K9v5/src/macros.jl:11

```

---

<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: [July 20, 2019, 11:01pm UTC](https://discourse.julialang.org/t/error-with-ode-def/18594/14 "2019-07-20T23:01:17Z")

</div>

Try rebuilding SymEngine

---

<div class="post-metadata">

### Author: ![sbacelar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sbacelar/32/4359_2.png) [@sbacelar](https://discourse.julialang.org/u/sbacelar)
#### Post date: [July 20, 2019, 11:18pm UTC](https://discourse.julialang.org/t/error-with-ode-def/18594/15 "2019-07-20T23:18:19Z")

</div>

I deleted `SymEngine` in `.julia/packages` and then rebuild it. But I still got an error. My version of `SymEngine` is 0.7.0 and `Julia 1.1.1.`

---

<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: [July 21, 2019, 8:36am UTC](https://discourse.julialang.org/t/error-with-ode-def/18594/16 "2019-07-21T08:36:40Z")

</div>

I need to see the error you get from `import Pkg; Pkg.build("SymEngine")` or I can’t help.

Anyways, I would highly recommend updating to the newer [https://github.com/JuliaDiffEq/ModelingToolkit.jl](https://github.com/JuliaDiffEq/ModelingToolkit.jl) (which cannot have these kinds of install problems since it’s a pure Julia library!)

---

<div class="post-metadata">

### Author: ![sbacelar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sbacelar/32/4359_2.png) [@sbacelar](https://discourse.julialang.org/u/sbacelar)
#### Post date: [July 21, 2019, 12:10pm UTC](https://discourse.julialang.org/t/error-with-ode-def/18594/17 "2019-07-21T12:10:46Z")

</div>

Thank you for your answer. The problem is now solved.  
I got no errors when following your instructions to build `SymEngine`.  
I updated `DiffEqTutorials.jl` (`git pull origin master`). And now it works fine but nevertheless, I will try your suggestion of using `ModelingToolkit.jl`.  
Note: I have created a new cell in Jupyter with `using SymEngine`. Is it really necessary?
