# Error while using LSODA

**URL:** <https://discourse.julialang.org/t/error-while-using-lsoda/100614>\
**Category:** New to Julia\
**Tags:** question, differentialequation\
**Created:** [June 20, 2023, 4:11pm UTC](https://discourse.julialang.org/t/error-while-using-lsoda/100614 "2023-06-20T16:11:32Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sahil\_Khan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sahil_khan/32/47573_2.png) [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Post date:** [June 20, 2023, 4:11pm UTC](https://discourse.julialang.org/t/error-while-using-lsoda/100614/1 "2023-06-20T16:11:32Z")

</div>

I’m getting this error while using LSODA

`ERROR: UndefVarError: `liblsoda` not defined`

CODE:

```julia
using DifferentialEquations, LSODA

function lorenz!(du,u,p,t)
    a1, a2, a3 = p
    a, b, c = u
    du[1] = a1*(b-a)
    du[2] = a*(a2-c) - b
    du[3] = a*b - (a3)*c
end
p = [10.0, 28.0, 8/3]
u0 = [1.0;0.0;0.0]
tspan = (0.0,100.0)
prob = ODEProblem(lorenz!,u0,tspan, p)
solve(prob,lsoda())

```

---

<div class="post-metadata">

**Author:** ![frylock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frylock/32/50213_2.png) [@frylock](https://discourse.julialang.org/u/frylock)\
**Post date:** [June 20, 2023, 4:26pm UTC](https://discourse.julialang.org/t/error-while-using-lsoda/100614/2 "2023-06-20T16:26:23Z")

</div>

It could be that while `LSODA.jl` provides bindings to `liblsoda.so` … that it does not actually install this library on your system? If you are in Linux, you could check with:

```julia
ldconfig -p | grep liblsoda

```

---

<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:** [June 20, 2023, 5:10pm UTC](https://discourse.julialang.org/t/error-while-using-lsoda/100614/3 "2023-06-20T17:10:55Z")

</div>

Try `]build LSODA` and see what the error is.

---

<div class="post-metadata">

**Author:** ![Sahil\_Khan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sahil_khan/32/47573_2.png) [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Post date:** [June 21, 2023, 7:40am UTC](https://discourse.julialang.org/t/error-while-using-lsoda/100614/4 "2023-06-21T07:40:52Z")

</div>

I get this error when trying to build.

```julia
error in running finalizer: UndefVarError(var=:liblsoda)

```

---

<div class="post-metadata">

**Author:** ![Sahil\_Khan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sahil_khan/32/47573_2.png) [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Post date:** [June 21, 2023, 7:53am UTC](https://discourse.julialang.org/t/error-while-using-lsoda/100614/5 "2023-06-21T07:53:53Z")

</div>

I’m using a Mac system.

---

<div class="post-metadata">

**Author:** ![frylock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frylock/32/50213_2.png) [@frylock](https://discourse.julialang.org/u/frylock)\
**Post date:** [June 21, 2023, 11:53am UTC](https://discourse.julialang.org/t/error-while-using-lsoda/100614/6 "2023-06-21T11:53:23Z")

</div>

Sounds like you don’t have `lsoda` installed? Relevant link on [SO](https://stackoverflow.com/questions/73177441/running-lsoda-jl-examples-on-apple-m1).

---

<div class="post-metadata">

**Author:** ![Sahil\_Khan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sahil_khan/32/47573_2.png) [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Post date:** [June 21, 2023, 11:59am UTC](https://discourse.julialang.org/t/error-while-using-lsoda/100614/7 "2023-06-21T11:59:55Z")

</div>

I have checked that link. There is no solution.

when i do `using LSODA` I see no error. So, I assume it means i have package right?

Only when i’m trying to use it I see error.

---

<div class="post-metadata">

**Author:** ![frylock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frylock/32/50213_2.png) [@frylock](https://discourse.julialang.org/u/frylock)\
**Post date:** [June 21, 2023, 12:15pm UTC](https://discourse.julialang.org/t/error-while-using-lsoda/100614/8 "2023-06-21T12:15:09Z")

</div>

I’m not a packaging expert, but the [repository for LSODA](https://github.com/rveltz/LSODA.jl) does not appear to have the library in it. I’m not quite sure how the package author was expecting that you get the library installed.

I see no error when I issue `using LSODA`, but I for sure do not have the library installed (at least `ldconfig` doesn’t think so).

---

<div class="post-metadata">

**Author:** ![frylock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frylock/32/50213_2.png) [@frylock](https://discourse.julialang.org/u/frylock)\
**Post date:** [June 21, 2023, 12:17pm UTC](https://discourse.julialang.org/t/error-while-using-lsoda/100614/9 "2023-06-21T12:17:40Z")

</div>

This is the group that developed the LSODA algorithm:  
[https://computing.llnl.gov/projects/sundials](https://computing.llnl.gov/projects/sundials)  
They have a download page.

---

<div class="post-metadata">

**Author:** ![Sahil\_Khan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sahil_khan/32/47573_2.png) [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Post date:** [June 21, 2023, 12:24pm UTC](https://discourse.julialang.org/t/error-while-using-lsoda/100614/10 "2023-06-21T12:24:33Z")

</div>

It worked on my linux system.

---

<div class="post-metadata">

**Author:** ![frylock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frylock/32/50213_2.png) [@frylock](https://discourse.julialang.org/u/frylock)\
**Post date:** [June 21, 2023, 12:25pm UTC](https://discourse.julialang.org/t/error-while-using-lsoda/100614/11 "2023-06-21T12:25:16Z")

</div>

I think I see how they get the library. They have `using LSODA_jll` [here](https://github.com/rveltz/LSODA.jl/blob/master/src/LSODA.jl#L8). Perhaps it is a simple matter of `] add LSODA_jll`? (Not familiar with jll format either, but I know it is a binary wrapper of some sort).

---

<div class="post-metadata">

**Author:** ![Sahil\_Khan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sahil_khan/32/47573_2.png) [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Post date:** [June 21, 2023, 12:28pm UTC](https://discourse.julialang.org/t/error-while-using-lsoda/100614/12 "2023-06-21T12:28:15Z")

</div>

No, it’s not working :(. I feel may be issue comes with installing LSODA on mac because I just installed on linux and used same example code and it worked.

---

<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:** [June 21, 2023, 1:00pm UTC](https://discourse.julialang.org/t/error-while-using-lsoda/100614/13 "2023-06-21T13:00:30Z")

</div>

Maybe it’s a supported platform thing. Do you have a Mac with an M1 or M2?

> **[GitHub - JuliaBinaryWrappers/LSODA\_jll.jl](https://github.com/JuliaBinaryWrappers/LSODA_jll.jl#platforms)**
>
> Contribute to JuliaBinaryWrappers/LSODA\_jll.jl development by creating an account on GitHub.

The binary builder was last ran 2 years ago so I don’t know if it made M1/M2 binaries. @giordano or @staticfloat might be able to help with that since it’s probably nothing more than just re-running the old Yggdrasil or whatnot.

---

<div class="post-metadata">

**Author:** ![Sahil\_Khan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sahil_khan/32/47573_2.png) [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Post date:** [June 21, 2023, 1:13pm UTC](https://discourse.julialang.org/t/error-while-using-lsoda/100614/14 "2023-06-21T13:13:37Z")

</div>

I’m using mac with M1.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [June 21, 2023, 1:44pm UTC](https://discourse.julialang.org/t/error-while-using-lsoda/100614/15 "2023-06-21T13:44:33Z")

</div>

Update your packages with `]up` and try again.

---

<div class="post-metadata">

**Author:** ![Sahil\_Khan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sahil_khan/32/47573_2.png) [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Post date:** [June 21, 2023, 1:52pm UTC](https://discourse.julialang.org/t/error-while-using-lsoda/100614/16 "2023-06-21T13:52:51Z")

</div>

It works now. Thank you 🙂
