# Failed to precompile Gurobi

**URL:** <https://discourse.julialang.org/t/failed-to-precompile-gurobi/122069>\
**Category:** Optimization (Mathematical)\
**Tags:** question, gurobi\
**Created:** [October 31, 2024, 12:27pm UTC](https://discourse.julialang.org/t/failed-to-precompile-gurobi/122069 "2024-10-31T12:27:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Y\_Naruse](https://avatars.discourse-cdn.com/v4/letter/y/9fc348/32.png) [@Y\_Naruse](https://discourse.julialang.org/u/Y_Naruse)\
**Post date:** [October 31, 2024, 12:27pm UTC](https://discourse.julialang.org/t/failed-to-precompile-gurobi/122069/1 "2024-10-31T12:27:16Z")

</div>

I want to use Gurobi on Julia.  
When I try to add Gurobi like this, it fails.

```julia
julia> import Pkg
julia> Pkg.add("Gurobi")
   Resolving package versions...
  No Changes to `C:\Users\N185062\.julia\environments\v1.11\Project.toml`
  No Changes to `C:\Users\N185062\.julia\environments\v1.11\Manifest.toml`
Precompiling project...
  ✗ Gurobi
  0 dependencies successfully precompiled in 7 seconds. 87 already precompiled.
  1 dependency errored.
  For a report of the errors see `julia> err`. To retry use `pkg> precompile`

```

LoadError seem to occur. How can I do?

```julia
julia > err
PkgPrecompileError: The following 1 direct dependency failed to precompile:

Gurobi

Failed to precompile Gurobi [2e9cd046-0924-5485-92f1-d5272153d98b] to "C:\\Users\\N185062\\.julia\\compiled\\v1.11\\Gurobi\\jl_6DE.tmp".
ERROR: LoadError: SystemError: opening file "C:\\Users\\N185062\\.julia\\packages\\Gurobi\\8rQku\\deps\\deps.jl": No such file or directory

```

---

<div class="post-metadata">

**Author:** ![Y\_Naruse](https://avatars.discourse-cdn.com/v4/letter/y/9fc348/32.png) [@Y\_Naruse](https://discourse.julialang.org/u/Y_Naruse)\
**Post date:** [November 1, 2024, 12:29am UTC](https://discourse.julialang.org/t/failed-to-precompile-gurobi/122069/2 "2024-11-01T00:29:55Z")

</div>

This problem was solved  
not using  
julia\> Pkg.add(“Gurobi”)  
but using  
julia\> Pkg.build(“Gurobi”)

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:** [November 1, 2024, 1:29am UTC](https://discourse.julialang.org/t/failed-to-precompile-gurobi/122069/3 "2024-11-01T01:29:23Z")

</div>

Hi @Y_Naruse, welcome to the forum 😄

You can find the instructions for installing Gurobi here: [GitHub - jump-dev/Gurobi.jl: A Julia interface to the Gurobi Optimizer](https://github.com/jump-dev/Gurobi.jl/tree/master?tab=readme-ov-file#installation)

I’m glad you got it working. It sounds like you might have an older version of Gurobi.jl installed that does not support automatically installing the Gurobi binaries (check what the output of `import Pkg; Pkg.status()` is), so yes, you needed to run `Pkg.build` to find the local installation.

---

<div class="post-metadata">

**Author:** ![Y\_Naruse](https://avatars.discourse-cdn.com/v4/letter/y/9fc348/32.png) [@Y\_Naruse](https://discourse.julialang.org/u/Y_Naruse)\
**Post date:** [November 1, 2024, 2:26am UTC](https://discourse.julialang.org/t/failed-to-precompile-gurobi/122069/4 "2024-11-01T02:26:27Z")

</div>

## Thank you so much for your instruction. I confirmed. After “Pkg.add(“Gurobi\_jll”)”, Gurobi\_jll v11.0.3 was added. Is that Okay?

julia\> Pkg.status()  
Status `C:\Users\N185062\.julia\environments\v1.11\Project.toml`  
[2e9cd046] Gurobi v1.3.1  
[7073ff75] IJulia v1.25.0  
[4076af6c] JuMP v1.23.3  
[b964fa9f] LaTeXStrings v1.4.0  
[23fbe1c1] Latexify v0.16.5  
[f27b6e38] Polynomials v4.0.11  
[f3b207a7] StatsPlots v0.15.7

julia\> import Pkg

julia\> Pkg.add(“Gurobi\_jll”)  
Resolving package versions…  
Updating `C:\Users\N185062\.julia\environments\v1.11\Project.toml`  
[c018c7e6] + Gurobi\_jll v11.0.3  
No Changes to `C:\Users\N185062\.julia\environments\v1.11\Manifest.toml`

## julia\> Pkg.status() Status `C:\Users\N185062\.julia\environments\v1.11\Project.toml` [2e9cd046] Gurobi v1.3.1 [7073ff75] IJulia v1.25.0 [4076af6c] JuMP v1.23.3 [b964fa9f] LaTeXStrings v1.4.0 [23fbe1c1] Latexify v0.16.5 [f27b6e38] Polynomials v4.0.11 [f3b207a7] StatsPlots v0.15.7 [c018c7e6] Gurobi\_jll v11.0.3

---

<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 1, 2024, 2:29am UTC](https://discourse.julialang.org/t/failed-to-precompile-gurobi/122069/5 "2024-11-01T02:29:53Z")

</div>

That looks good. I’m not sure what the issue was.
