# How to use KNITRO on Ubuntu?

**URL:** https://discourse.julialang.org/t/how-to-use-knitro-on-ubuntu/120968
**Category:** Optimization (Mathematical)
**Tags:** question, package, jump
**Created:** [October 6, 2024, 8:03am UTC](https://discourse.julialang.org/t/how-to-use-knitro-on-ubuntu/120968 "2024-10-06T08:03:32Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![kevinqiao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevinqiao/32/44492_2.png) [@kevinqiao](https://discourse.julialang.org/u/kevinqiao)
#### Post date: [October 6, 2024, 8:03am UTC](https://discourse.julialang.org/t/how-to-use-knitro-on-ubuntu/120968/1 "2024-10-06T08:03:32Z")

</div>

I’m using JuMP and KNITRO on Ubuntu (Remote), the solver KNITRO has been installed successfully, and KNITRO.jl is installed as well, the env command `KNITRODIR` and `LD_LIBRARY_PATH` are set, building KNITRO is successful, but `using JuMP, KNITRO``KNITRO.has_knitro()` gives me `false`, all the packages used are latest, I don’t know why, the following is the error msgs:  
`ERROR: could not load symbol "KN_new": /opt/julia/bin/julia: undefined symbol: KN_new Stacktrace: [1] KN_new @ ~/data/wjqiao/julia/juliaPkg/packages/KNITRO/tnAEC/src/libknitro.jl:29 [inlined] [2] KN_new() @ KNITRO ~/data/wjqiao/julia/juliaPkg/packages/KNITRO/tnAEC/src/C_wrapper.jl:10 [3] KNITRO.Optimizer(; license_manager::Nothing, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ KNITRO ~/data/wjqiao/julia/juliaPkg/packages/KNITRO/tnAEC/src/MOI_wrapper.jl:146 [4] KNITRO.Optimizer() @ KNITRO ~/data/wjqiao/julia/juliaPkg/packages/KNITRO/tnAEC/src/MOI_wrapper.jl:139 [5] _instantiate_and_check(optimizer_constructor::Any) @ MathOptInterface ~/.julia/packages/MathOptInterface/1fRdT/src/instantiate.jl:94 [6] instantiate(optimizer_constructor::Any; with_bridge_type::Type{Float64}, with_cache_type::Nothing) @ MathOptInterface ~/.julia/packages/MathOptInterface/1fRdT/src/instantiate.jl:175 [7] set_optimizer(model::Model, optimizer_constructor::Any; add_bridges::Bool) @ JuMP ~/.julia/packages/JuMP/PKxEW/src/optimizer_interface.jl:493 [8] Model(optimizer_factory::Any; add_bridges::Bool) @ JuMP ~/.julia/packages/JuMP/PKxEW/src/JuMP.jl:200 [9] Model(optimizer_factory::Any) @ JuMP ~/.julia/packages/JuMP/PKxEW/src/JuMP.jl:192 [10] top-level scope @ ~/data/qwj/tstJuMP.jl:5 `

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [October 6, 2024, 10:19am UTC](https://discourse.julialang.org/t/how-to-use-knitro-on-ubuntu/120968/2 "2024-10-06T10:19:08Z")

</div>

Can you share the output of

```julia
using Pkg
Pkg.status()

```

and the output of

```julia
versioninfo()

```

?

---

<div class="post-metadata">

### Author: ![franckgaga](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/franckgaga/32/218241_2.png) [@franckgaga](https://discourse.julialang.org/u/franckgaga)
#### Post date: [October 6, 2024, 4:11pm UTC](https://discourse.julialang.org/t/how-to-use-knitro-on-ubuntu/120968/3 "2024-10-06T16:11:50Z")

</div>

I had a similar problem. In the `README.md` of KNITRO.jl github:

> - If `KNITRO.has_knitro()` returns `false` but you are confident that your paths are correct, try running `Pkg.build("KNITRO")` and restarting Julia. In at least one user’s experience, installing and using KNITRO in a temporary Julia environment (activated with `] activate --temp`) does not work and the need to manually build is likely the reason why.

It worked for me.

---

<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: [October 7, 2024, 1:44am UTC](https://discourse.julialang.org/t/how-to-use-knitro-on-ubuntu/120968/4 "2024-10-07T01:44:52Z")

</div>

KNITRODIR should be set such that `${KNITRODIR}/lib/libknitro.so` exists.

I’ve clarified this in a PR [Clarify installation instructions in the README by odow · Pull Request #304 · jump-dev/KNITRO.jl · GitHub](https://github.com/jump-dev/KNITRO.jl/pull/304)

---

<div class="post-metadata">

### Author: ![kevinqiao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevinqiao/32/44492_2.png) [@kevinqiao](https://discourse.julialang.org/u/kevinqiao)
#### Post date: [October 10, 2024, 12:08pm UTC](https://discourse.julialang.org/t/how-to-use-knitro-on-ubuntu/120968/5 "2024-10-10T12:08:10Z")

</div>

I have the latest version KNITRO.jl and JuMP.jl, the problem is solved by @odow, thank you.

---

<div class="post-metadata">

### Author: ![kevinqiao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevinqiao/32/44492_2.png) [@kevinqiao](https://discourse.julialang.org/u/kevinqiao)
#### Post date: [October 10, 2024, 12:08pm UTC](https://discourse.julialang.org/t/how-to-use-knitro-on-ubuntu/120968/6 "2024-10-10T12:08:58Z")

</div>

Thank you, it works for me.
