Error with ode_def

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

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

What does ]build SymEngine give you?

oh, Hash Mismatch, what should I do?

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

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.

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

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/

This was fixed by 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?

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

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

problem solved since the SymEngine has been updated
:+1:

2 Likes

Great! Glad it worked.

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

error compiling _symbol: could not load library "symengine"

a = symbols("a") produces the same error, so I guess there is something wrong with SymEngine.jl. Opened issue #168

I have a similar error:

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

Try rebuilding SymEngine

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.

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 (which cannot have these kinds of install problems since it’s a pure Julia library!)

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?