Failed to precompile Gurobi

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

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 > 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

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

Thank you!

Hi @Y_Naruse, welcome to the forum :smile:

You can find the instructions for installing Gurobi here: GitHub - jump-dev/Gurobi.jl: A Julia interface to the Gurobi Optimizer

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.

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

1 Like

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