# CI integration failed with Gurobi.jl in environment

**URL:** <https://discourse.julialang.org/t/ci-integration-failed-with-gurobi-jl-in-environment/126236>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump, github-actions, gurobi\
**Created:** [February 24, 2025, 6:34am UTC](https://discourse.julialang.org/t/ci-integration-failed-with-gurobi-jl-in-environment/126236 "2025-02-24T06:34:46Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Betristor](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/betristor/32/45264_2.png) [@Betristor](https://discourse.julialang.org/u/Betristor)\
**Post date:** [February 24, 2025, 6:34am UTC](https://discourse.julialang.org/t/ci-integration-failed-with-gurobi-jl-in-environment/126236/1 "2025-02-24T06:34:46Z")

</div>

I have a Julia package in development which has Gurobi.jl in environment as an available solver. Somehow, the github CI integration is against the Gurobi.jl pre-compilation since no license could be found on github action machine. However, the CI process will not use Gurobi for testing, instead HiGHS will be used. Is there a way to keep the Gurobi.jl in environment, while I could skip the license validation?

Here is the trace provided by github action.

```julia
Failed to precompile Gurobi [2e9cd046-0924-5485-92f1-d5272153d98b] to "/home/runner/.julia/compiled/v1.11/Gurobi/jl_jh7YaY".
ERROR: LoadError: Gurobi Error 10009: No Gurobi license found (user runner, host fv-az795-534, hostid 3a60c19e, cores 1)
Stacktrace:
  [1] _check_ret
    @ ~/.julia/packages/Gurobi/P8NrB/src/MOI_wrapper/MOI_wrapper.jl:442 [inlined]
  [2] Gurobi.Env(params::Nothing; started::Bool, output_flag::Int64, memory_limit::Nothing)
    @ Gurobi ~/.julia/packages/Gurobi/P8NrB/src/MOI_wrapper/MOI_wrapper.jl:176
  [3] Env (repeats 2 times)
    @ ~/.julia/packages/Gurobi/P8NrB/src/MOI_wrapper/MOI_wrapper.jl:143 [inlined]
  [4] Gurobi.Optimizer(env::Nothing; enable_interrupts::Bool)
    @ Gurobi ~/.julia/packages/Gurobi/P8NrB/src/MOI_wrapper/MOI_wrapper.jl:372
  [5] Optimizer (repeats 2 times)
    @ ~/.julia/packages/Gurobi/P8NrB/src/MOI_wrapper/MOI_wrapper.jl:366 [inlined]
  [6] _instantiate_and_check
    @ ~/.julia/packages/MathOptInterface/zRYzr/src/instantiate.jl:94 [inlined]
  [7] #instantiate#36
    @ ~/.julia/packages/MathOptInterface/zRYzr/src/instantiate.jl:175 [inlined]
  [8] instantiate
    @ ~/.julia/packages/MathOptInterface/zRYzr/src/instantiate.jl:160 [inlined]
  [9] macro expansion
    @ ~/.julia/packages/Gurobi/P8NrB/src/Gurobi.jl:120 [inlined]
 [10] macro expansion
    @ ~/.julia/packages/PrecompileTools/L8A3n/src/workloads.jl:78 [inlined]
 [11] macro expansion
    @ ~/.julia/packages/Gurobi/P8NrB/src/Gurobi.jl:118 [inlined]
 [12] macro expansion
    @ ~/.julia/packages/PrecompileTools/L8A3n/src/workloads.jl:140 [inlined]
 [13] top-level scope
    @ ~/.julia/packages/Gurobi/P8NrB/src/Gurobi.jl:117
 [14] include
    @ ./Base.jl:557 [inlined]
 [15] 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, UInt128}}, source::Nothing)
    @ Base ./loading.jl:2881
 [16] top-level scope
    @ stdin:6
in expression starting at /home/runner/.julia/packages/Gurobi/P8NrB/src/Gurobi.jl:7
in expression starting at stdin:6

```

---

<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:** [February 24, 2025, 7:08pm UTC](https://discourse.julialang.org/t/ci-integration-failed-with-gurobi-jl-in-environment/126236/2 "2025-02-24T19:08:15Z")

</div>

> I have a Julia package in development which has [Gurobi.jl](https://juliaregistries.github.io/General/packages/redirect_to_repo/Gurobi) in environment as an available solver.

Don’t do this.

Let the user choose which solver to use. There is no need to add it to the `Project.toml`. Adding solvers to the `Project.toml` means that every user installs all of the solvers, even if they never end up using them, and it runs into license issues like the one you are experiencing.

---

<div class="post-metadata">

**Author:** ![Fe-r-oz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fe-r-oz/32/216415_2.png) [@Fe-r-oz](https://discourse.julialang.org/u/Fe-r-oz)\
**Post date:** [February 25, 2025, 3:06am UTC](https://discourse.julialang.org/t/ci-integration-failed-with-gurobi-jl-in-environment/126236/3 "2025-02-25T03:06:23Z")

</div>

Thank you for your helpful insight. I might made this mistake, I added `PkgJuMPExt = ["GLPK", "HiGHS", "JuMP"]` in `project.toml` but everything works fine and okay 🙂 I have dependency issues when adding `SCIP.jl` though.

So, we really don’t need to add any solver at all? Currently, I have `opt = solver.Optimizer` with default `solver = HIGHS`, and then I call ` model = Model(opt; add_bridges = false)`. So, the user can decide which solver to pass as `solver.Optimizer`? I hope I understood your comment correctly. Thank you for your time and consideration!

---

<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:** [February 25, 2025, 3:26am UTC](https://discourse.julialang.org/t/ci-integration-failed-with-gurobi-jl-in-environment/126236/4 "2025-02-25T03:26:54Z")

</div>

See this tutorial, but especially the linked section:

> **[Design patterns for larger models · JuMP](https://jump.dev/JuMP.jl/stable/tutorials/getting_started/design_patterns_for_larger_models/#Remove-solver-dependence,-add-error-checks)**
>
> Documentation for JuMP.

There is rarely a good reason to hard-code the choice of solver for the user. Even if you include a “default” solver like HiGHS, if the user chooses to use a different solver like SCIP or Gurobi, then installing your package will make them download and install HiGHS. Just let them choose, and document how to install some suggested packages.

> “GLPK”

Also: can I ask why are you using GLPK?

---

<div class="post-metadata">

**Author:** ![Fe-r-oz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fe-r-oz/32/216415_2.png) [@Fe-r-oz](https://discourse.julialang.org/u/Fe-r-oz)\
**Post date:** [February 25, 2025, 3:34am UTC](https://discourse.julialang.org/t/ci-integration-failed-with-gurobi-jl-in-environment/126236/5 "2025-02-25T03:34:05Z")

</div>

Thank you for your wonderful insights!

> [@odow](#):
>
> Also: can I ask why are you using GLPK?

My apologies for the oversight! The [paper, page 20](https://arxiv.org/pdf/1904.02703) that applied the mixed-integer problem formulation used `GLPK`. Based on your insightful comment [here](https://discourse.julialang.org/t/is-glpk-still-maintained-relevant/116950/4), I now understand that we should use `HIGHS` instead 🙂 Thank you for your help!

---

<div class="post-metadata">

**Author:** ![Betristor](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/betristor/32/45264_2.png) [@Betristor](https://discourse.julialang.org/u/Betristor)\
**Post date:** [February 25, 2025, 4:29am UTC](https://discourse.julialang.org/t/ci-integration-failed-with-gurobi-jl-in-environment/126236/6 "2025-02-25T04:29:16Z")

</div>

In my experience, only Gurobi.jl will have the issue problem. I also have Cbc, Clp, Ipopt, GLPK, COPT, and CPLEX solvers configured internally but the `solver.Optimizer` does not lead to the license issue.

---

<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:** [February 25, 2025, 6:11am UTC](https://discourse.julialang.org/t/ci-integration-failed-with-gurobi-jl-in-environment/126236/7 "2025-02-25T06:11:16Z")

</div>

> Cbc, Clp, Ipopt, GLPK

These are open source, and do not require a license.

> COPT

COPT is an official product of Cardinal. They provide automatic binaries on install.

> CPLEX

This should almost certainly result in the same issue as Gurobi. Are you sure it works?

---

<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:** [February 25, 2025, 6:12am UTC](https://discourse.julialang.org/t/ci-integration-failed-with-gurobi-jl-in-environment/126236/8 "2025-02-25T06:12:16Z")

</div>

But the moral of the story is don’t preselect a fixed set of solvers that you distribute to users. Let them choose. That’s one of the nice things about JuMP.

---

<div class="post-metadata">

**Author:** ![Betristor](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/betristor/32/45264_2.png) [@Betristor](https://discourse.julialang.org/u/Betristor)\
**Post date:** [February 25, 2025, 7:12am UTC](https://discourse.julialang.org/t/ci-integration-failed-with-gurobi-jl-in-environment/126236/9 "2025-02-25T07:12:23Z")

</div>

I checked the codes, I do intend to use CPLEX but the license acquirance failed. So CPLEX is out of my scope.

---

<div class="post-metadata">

**Author:** ![Betristor](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/betristor/32/45264_2.png) [@Betristor](https://discourse.julialang.org/u/Betristor)\
**Post date:** [February 25, 2025, 7:15am UTC](https://discourse.julialang.org/t/ci-integration-failed-with-gurobi-jl-in-environment/126236/10 "2025-02-25T07:15:23Z")

</div>

I think I need to weigh the tradeoffs between the flexibility of users choosing solvers and convenience of specifying the solver with `settings["Solver"]='Gurobi'`. I have implemented the solver choice outside of the package and the CI passed. Much thanks!

---

<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:** [February 25, 2025, 8:38am UTC](https://discourse.julialang.org/t/ci-integration-failed-with-gurobi-jl-in-environment/126236/11 "2025-02-25T08:38:35Z")

</div>

Don’t use a string to control the optimizer. Just let the user do:

```julia
import Gurobi
settings["Solver"]=Gurobi.Optimizer

```

---

<div class="post-metadata">

**Author:** ![Baptiste\_PJ](https://avatars.discourse-cdn.com/v4/letter/b/d78d45/32.png) [@Baptiste\_PJ](https://discourse.julialang.org/u/Baptiste_PJ)\
**Post date:** [August 7, 2025, 8:11am UTC](https://discourse.julialang.org/t/ci-integration-failed-with-gurobi-jl-in-environment/126236/12 "2025-08-07T08:11:08Z")

</div>

Hello, thank you for the answers.

I ran into the same issue, using Gurobi for the dual simplex algorithm (specifically required) in linear optimization – and because of licensing the packaging of the code seems blocked.

In the code I have, in the main file there is a `const GUROBI_ENV = Gurobi.Env()`

and the subproblems are solved in a function (in another file) containing

```julia-auto
model = Model(() -> Gurobi.Optimizer(GUROBI_ENV))
set_silent(model) # avoid printings
set_optimizer_attribute(model, "OutPutFlag", 0)         
set_optimizer_attribute(model, "Method", -1) # dual simplex

```

Is there a way to set the dual simplex whatever the optimizer is? (not very familiar with JuMP, it may be trivial)

And in case (though I doubt so) it is a reason to put a default solver (Gurobi here), is there a way to make a package with a prescribed solved anyways?

---

<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:** [August 7, 2025, 8:27am UTC](https://discourse.julialang.org/t/ci-integration-failed-with-gurobi-jl-in-environment/126236/14 "2025-08-07T08:27:55Z")

</div>

> Is there a way to set the dual simplex whatever the optimizer is

Nope

> is there a way to make a package with a prescribed solver anyways?

You can add Gurobi as a dependency. You’ll just get errors if people dont have a gurobi license (like CI).

You could use HiGHS.jl. it has a dual simplex.

---

<div class="post-metadata">

**Author:** ![Baptiste\_PJ](https://avatars.discourse-cdn.com/v4/letter/b/d78d45/32.png) [@Baptiste\_PJ](https://discourse.julialang.org/u/Baptiste_PJ)\
**Post date:** [August 7, 2025, 8:40am UTC](https://discourse.julialang.org/t/ci-integration-failed-with-gurobi-jl-in-environment/126236/15 "2025-08-07T08:40:01Z")

</div>

If HiGHS does not require a license and passes the CI test more easily, then it is probably the simpler choice.

Thanks for the fast reply
