# Needs help on \[IPOPT + coinhsl\] installation

**URL:** <https://discourse.julialang.org/t/needs-help-on-ipopt-coinhsl-installation/40583>\
**Category:** Optimization (Mathematical)\
**Created:** [June 1, 2020, 8:54pm UTC](https://discourse.julialang.org/t/needs-help-on-ipopt-coinhsl-installation/40583 "2020-06-01T20:54:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![SingingKim](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@SingingKim](https://discourse.julialang.org/u/SingingKim)\
**Post date:** [June 1, 2020, 8:54pm UTC](https://discourse.julialang.org/t/needs-help-on-ipopt-coinhsl-installation/40583/1 "2020-06-01T20:54:03Z")

</div>

Hi, I would like to know a way to connect a linear solver other than MUMPS on Ipopt.

```julia
m = Model(Ipopt.Optimizer)
set_optimizer_attribute(m, "linear_solver", "ma86")
@variable(m, x <= 5)
@objective(m, Max, x)
JuMP.optimize!(m)

```

Error:

```julia
Exception of type: OPTION_INVALID in file "IpAlgBuilder.cpp" at line 349:
 Exception message: Selected linear solver HSL_MA86 not available.
Tried to obtain HSL_MA86 from shared library "libhsl.dylib", but the following error occured:
dlopen(libhsl.dylib, 2): image not found

EXIT: Invalid option encountered.

```

I downloaded “coinhsl” library but I don’t know how to connect this to the installed IPOPT.  
Any guidance would be highly appreciated. Thank you!

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [June 1, 2020, 9:13pm UTC](https://discourse.julialang.org/t/needs-help-on-ipopt-coinhsl-installation/40583/2 "2020-06-01T21:13:49Z")

</div>

See the discussion and instructions here: [BUG: Tried to obtain HSL\_MA86 from shared library "libhsl.dylib" · Issue #197 · jump-dev/Ipopt.jl · GitHub](https://github.com/JuliaOpt/Ipopt.jl/issues/197).

---

<div class="post-metadata">

**Author:** ![SingingKim](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@SingingKim](https://discourse.julialang.org/u/SingingKim)\
**Post date:** [June 1, 2020, 9:31pm UTC](https://discourse.julialang.org/t/needs-help-on-ipopt-coinhsl-installation/40583/3 "2020-06-01T21:31:49Z")

</div>

@odow Thank you so much! Your renaming solution worked for me:

Rename `/usr/local/lib/libcoinhsl.dylib` to `/usr/local/lib/libhsl.dylib`

---

<div class="post-metadata">

**Author:** ![SingingKim](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@SingingKim](https://discourse.julialang.org/u/SingingKim)\
**Post date:** [November 23, 2020, 3:32am UTC](https://discourse.julialang.org/t/needs-help-on-ipopt-coinhsl-installation/40583/4 "2020-11-23T03:32:17Z")

</div>

@odow I’ve been using IPOPT + HSL just fine thanks to your help.  
As I’m switching to Julia 1.5 from 1.3, I’m having a very strange issue with IPOPT + HSL.

```julia
using JuMP, Ipopt
m = Model(Ipopt.Optimizer)
set_optimizer_attribute(m, "linear_solver", "ma86") 
@variable(m, x <= 5)
@variable(m, y <= 45)
@objective(m, Max, x + y)
JuMP.optimize!(m)

```

This works just fine on Julia v1.3, but Julia v1.5 gives me the following error:

```julia
Exception of type: OPTION_INVALID in file "IpAlgBuilder.cpp" at line 349:
 Exception message: Selected linear solver HSL_MA86 not available.
Tried to obtain HSL_MA86 from shared library "libhsl.dylib", but the following error occured:
dlopen(libhsl.dylib, 2): image not found

EXIT: Invalid option encountered.

```

This is very strange as Julia 1.3 does not have this issue on the same computer. And I do have `libhsl.dylib` in `/usr/local/lib` directory.

```julia
singingkim@Mac-mini:~$ find /usr/local/lib -name "*hsl.dylib"
/usr/local/lib/libcoinhsl.dylib
/usr/local/lib/libhsl.dylib

```

Do you have any idea where to look to fix this issue?

```julia
(@v1.5) pkg> status
Status `~/.julia/environments/v1.5/Project.toml`
  [a076750e] CPLEX v0.7.3
  [aaaa29a8] Clustering v0.14.2
  [a93c6f00] DataFrames v0.22.1
  [31c24e10] Distributions v0.24.4
  [1ca51c6a] GAMS v0.1.4
  [2e9cd046] Gurobi v0.9.3
  [7073ff75] IJulia v1.23.0
  [b6b21f68] Ipopt v0.6.3
  [4076af6c] JuMP v0.21.5
  [23992714] MAT v0.8.1
  [6405355b] Mosek v1.1.3
  [1ec41992] MosekTools v0.9.4
  [8bb1440f] DelimitedFiles

```

```julia
julia> versioninfo()
Julia Version 1.5.3
Commit 788b2c77c1 (2020-11-09 13:37 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)

```

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [November 23, 2020, 4:24am UTC](https://discourse.julialang.org/t/needs-help-on-ipopt-coinhsl-installation/40583/5 "2020-11-23T04:24:45Z")

</div>

> Do you have any idea where to look to fix this issue?

`libhls.dylib` needs to be on your load path. I guess Julia 1.5 changes in this regard.  
You need to be able to run

```Julia
using Libdl
dlopen("libhsl.dylib")

```

and have it return a non-null pointer.

See here for some instructions, although they don’t include MA86 yet (I don’t have, so I can’t test): [GitHub - jump-dev/Ipopt.jl: Julia interface to the Ipopt nonlinear solver](https://github.com/jump-dev/Ipopt.jl#linear-solvers)

I’ve opened this issue to track all the issues: [Linking Ipopt with linear solvers · Issue #247 · jump-dev/Ipopt.jl · GitHub](https://github.com/jump-dev/Ipopt.jl/issues/247)

---

<div class="post-metadata">

**Author:** ![SingingKim](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@SingingKim](https://discourse.julialang.org/u/SingingKim)\
**Post date:** [March 26, 2021, 7:28pm UTC](https://discourse.julialang.org/t/needs-help-on-ipopt-coinhsl-installation/40583/6 "2021-03-26T19:28:37Z")

</div>

Update: The problem on my mac is solved after adding the following line in “.bash\_profile”  
`export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib/"`

I still don’t understand how this resolves the issue, but it works for Julia 1.4-1.6 (Julia 1.3 did not have the issue).  
However, the issue remains when I run my codes on Atom REPL while VScode does not have the issue.
