# DifferentialEquations.jl precompilation fails for not finding libopenblas

**URL:** <https://discourse.julialang.org/t/differentialequations-jl-precompilation-fails-for-not-finding-libopenblas/70229>\
**Category:** New to Julia\
**Tags:** mkl, installation, differentialequation\
**Created:** [October 22, 2021, 5:01pm UTC](https://discourse.julialang.org/t/differentialequations-jl-precompilation-fails-for-not-finding-libopenblas/70229 "2021-10-22T17:01:36Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dasayan05](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dasayan05/32/14371_2.png) [@dasayan05](https://discourse.julialang.org/u/dasayan05)\
**Post date:** [October 22, 2021, 5:01pm UTC](https://discourse.julialang.org/t/differentialequations-jl-precompilation-fails-for-not-finding-libopenblas/70229/1 "2021-10-22T17:01:36Z")

</div>

I am using Julia 1.6.3 on Ubuntu 20.04 built from source with MKL turned on, so `BLAS.vendor()` says MKL. Now, I was trying to install the `DifferentialEquations` package simply by `] add DifferentialEquations`, which after `precompile`, throws the below error.

A quick glance at the error shows that it couldn’t find `libopenblas64_.so` library. I can’t understand whether its looking in the system (PS: I have `libopenblas.so` available through `LD_LIBRARY_PATH`) or some local location ? Or is it just not possible to use these libraries when Julia is build with MKL ?

Similar issue have been posted here before or on github, suggest to clean `~/.julia/` folder, which didn’t help.

```julia
(@v1.6) pkg> precompile
Precompiling project...
  ✗ SuiteSparse_jll
  ✗ Sundials_jll
  ✗ Sundials
  ✗ DifferentialEquations
  0 dependencies successfully precompiled in 22 seconds (173 already precompiled)

ERROR: The following 1 direct dependency failed to precompile:

DifferentialEquations [0c46a032-eb83-5123-abaf-570d42b7fbaa]

Failed to precompile DifferentialEquations [0c46a032-eb83-5123-abaf-570d42b7fbaa] to /user/HS229/ad01424/.julia/compiled/v1.6/DifferentialEquations/jl_FdQ9ya.
ERROR: LoadError: LoadError: InitError: could not load library "libopenblas64_.so"
libopenblas64_.so: cannot open shared object file: No such file or directory
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl ./libdl.jl:114
  [2] dlopen (repeats 2 times)
    @ ./libdl.jl:114 [inlined]
  [3] __init__ ()
    @ OpenBLAS_jll /vol/research/sketchapp/julia/v1.6.3/share/julia/stdlib/v1.6/OpenBLAS_jll/src/OpenBLAS_jll.jl:35
  [4] _include_from_serialized(path::String, depmods::Vector{Any})
    @ Base ./loading.jl:696
  [5] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base ./loading.jl:782
  [6] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1020
  [7] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:936
  [8] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:923
  [9] include(mod::Module, _path::String)
    @ Base ./Base.jl:386
 [10] include(x::String)
    @ Sundials_jll ~/.julia/packages/Sundials_jll/heTyl/src/Sundials_jll.jl:1
 [11] top-level scope
    @ ~/.julia/packages/Sundials_jll/heTyl/src/Sundials_jll.jl:54
 [12] include
    @ ./Base.jl:386 [inlined]
 [13] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
    @ Base ./loading.jl:1235
 [14] top-level scope
    @ none:1
 [15] eval
    @ ./boot.jl:360 [inlined]
 [16] eval(x::Expr)
    @ Base.MainInclude ./client.jl:446
 [17] top-level scope
    @ none:1
during initialization of module OpenBLAS_jll
in expression starting at /user/HS229/ad01424/.julia/packages/Sundials_jll/heTyl/src/wrappers/x86_64-linux-gnu-libgfortran4.jl:5
in expression starting at /user/HS229/ad01424/.julia/packages/Sundials_jll/heTyl/src/Sundials_jll.jl:1
ERROR: LoadError: Failed to precompile Sundials_jll [fb77eaff-e24c-56d4-86b1-d163f2edb164] to /user/HS229/ad01424/.julia/compiled/v1.6/Sundials_jll/jl_7yHnUe.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IOContext{Base.PipeEndpoint}, internal_stdout::IOContext{IOStream}, ignore_loaded_modules::Bool)
    @ Base ./loading.jl:1385
  [3] compilecache(pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1329
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1043
  [5] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:936
  [6] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:923
  [7] include
    @ ./Base.jl:386 [inlined]
  [8] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
    @ Base ./loading.jl:1235
  [9] top-level scope
    @ none:1
 [10] eval
    @ ./boot.jl:360 [inlined]
 [11] eval(x::Expr)
    @ Base.MainInclude ./client.jl:446
 [12] top-level scope
    @ none:1
in expression starting at /user/HS229/ad01424/.julia/packages/Sundials/sg9S0/src/Sundials.jl:3
ERROR: LoadError: Failed to precompile Sundials [c3572dad-4567-51f8-b174-8c6c989267f4] to /user/HS229/ad01424/.julia/compiled/v1.6/Sundials/jl_Cbtg52.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IOContext{Base.PipeEndpoint}, internal_stdout::IOContext{IOStream}, ignore_loaded_modules::Bool)
    @ Base ./loading.jl:1385
  [3] compilecache(pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1329
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1043
  [5] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:936
  [6] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:923
  [7] include
    @ ./Base.jl:386 [inlined]
  [8] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
    @ Base ./loading.jl:1235
  [9] top-level scope
    @ none:1
 [10] eval
    @ ./boot.jl:360 [inlined]
 [11] eval(x::Expr)
    @ Base.MainInclude ./client.jl:446
 [12] top-level scope
    @ none:1
in expression starting at /user/HS229/ad01424/.julia/packages/DifferentialEquations/7WPQg/src/DifferentialEquations.jl: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:** [October 22, 2021, 5:33pm UTC](https://discourse.julialang.org/t/differentialequations-jl-precompilation-fails-for-not-finding-libopenblas/70229/2 "2021-10-22T17:33:20Z")

</div>

Maybe this is a @staticfloat or @giordano question?

---

<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:** [October 22, 2021, 6:07pm UTC](https://discourse.julialang.org/t/differentialequations-jl-precompilation-fails-for-not-finding-libopenblas/70229/3 "2021-10-22T18:07:57Z")

</div>

To be honest, my recommendation is to use `MKL.jl` with Julia v1.7+ (v1.7.0-rc2 [was just announced](https://discourse.julialang.org/t/julia-v1-7-0-rc2-is-now-available/70228)), it makes so much easier switching BLAS library that spending time on debugging problems with older versions isn’t much worth the effort 🙂

---

<div class="post-metadata">

**Author:** ![dasayan05](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dasayan05/32/14371_2.png) [@dasayan05](https://discourse.julialang.org/u/dasayan05)\
**Post date:** [October 22, 2021, 7:15pm UTC](https://discourse.julialang.org/t/differentialequations-jl-precompilation-fails-for-not-finding-libopenblas/70229/4 "2021-10-22T19:15:10Z")

</div>

@giordano Ok. I took your suggestion and got `v1.7.0-rc2` with `MKL.jl` and it works fine now.

---

<div class="post-metadata">

**Author:** ![kunzaatko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kunzaatko/32/25153_2.png) [@kunzaatko](https://discourse.julialang.org/u/kunzaatko)\
**Post date:** [March 16, 2022, 6:10pm UTC](https://discourse.julialang.org/t/differentialequations-jl-precompilation-fails-for-not-finding-libopenblas/70229/5 "2022-03-16T18:10:49Z")

</div>

Hi, @dasayan05! I had the same problem right now. I found that `libopenblas64_.so` was in `/usr/lib/julia` as it came with julia. I fixed it by appending `/usr/lib/julia` to my `LD_LIBRARY_PATH`, which you do by appending to `bashrc`

```nohighlight
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/julia

```

or in fish

```nohighlight
set -gx LD_LIBRARY_PATH $LD_LIBRARY_PATH /usr/lib/julia

```

I located where the `so` actually was using the `locate` utility. Everything that failed now precompiles normally.

---

<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:** [March 16, 2022, 7:13pm UTC](https://discourse.julialang.org/t/differentialequations-jl-precompilation-fails-for-not-finding-libopenblas/70229/6 "2022-03-16T19:13:38Z")

</div>

> [@kunzaatko](#):
>
> I fixed it by appending `/usr/lib/julia` to my `LD_LIBRARY_PATH` ,

Julia’s directory should be the first, not the last one

---

<div class="post-metadata">

**Author:** ![kunzaatko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kunzaatko/32/25153_2.png) [@kunzaatko](https://discourse.julialang.org/u/kunzaatko)\
**Post date:** [March 18, 2022, 5:53am UTC](https://discourse.julialang.org/t/differentialequations-jl-precompilation-fails-for-not-finding-libopenblas/70229/7 "2022-03-18T05:53:30Z")

</div>

I am not convinced that it should be the first. It would be the case if my only use for shared libraries was julia, but it isn’t.  
Please, let me know if I am missing something…

---

<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:** [March 18, 2022, 9:09am UTC](https://discourse.julialang.org/t/differentialequations-jl-precompilation-fails-for-not-finding-libopenblas/70229/8 "2022-03-18T09:09:39Z")

</div>

> [@kunzaatko](#):
>
> am not convinced that it should be the first.

If you want Julia to work, that directory must be the first one. If other libraries in other directories are picked up first you don’t solve anything. My recommendation is actually that start Julia with

```julia
LD_LIBRARY_PATH="" julia

```

A shell wrapper would do it.

> [@kunzaatko](#):
>
> It would be the case if my only use for shared libraries was julia, but it isn’t.

I do _ **not** _ recommend setting LD\_LIBRARY\_PATH with julia directories for other programs. In the same way I don’t recommend setting LD\_LIBRARY\_PATH with other directories for Julia. LD\_LIBRARY\_PATH should be as minimal and as local as possible, a global catch-all setting is problematic.
