Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difficulties upgrading to Gurobi 9.1.1 due to conflicting old versions #400

Closed
niclasmattsson opened this issue Mar 11, 2021 · 0 comments · Fixed by #401
Closed

Difficulties upgrading to Gurobi 9.1.1 due to conflicting old versions #400

niclasmattsson opened this issue Mar 11, 2021 · 0 comments · Fixed by #401

Comments

@niclasmattsson
Copy link

I had a very hard time getting Gurobi.jl to use the most recent version after upgrading to Gurobi 9.1.1 from 9.0.3. After installing 9.1.1 on my system but leaving the previous versions in place:

julia> ENV["GUROBI_HOME"]
"C:\\Program Files\\Gurobi911\\win64"

julia> run(`gurobi_cl --version`)
Gurobi Optimizer version 9.1.1 build v9.1.1rc0 (win64)
Copyright (c) 2020, Gurobi Optimization, LLC
Process(`gurobi_cl --version`, ProcessExited(0))

(@v1.6) pkg> st
      Status `C:\Users\niclas\.julia\environments\v1.6\Project.toml`
  [2e9cd046] Gurobi v0.9.10
  [4076af6c] JuMP v0.21.6
  [295af30f] Revise v3.1.14

(@v1.6) pkg> build Gurobi
    Building Gurobi  `C:\Users\niclas\.julia\scratchspaces\44cfe95a-1eb2-52ea-b672-e2afdf69b78f\e66fa4ef62605be7730aa22832785ad9763e090e\build.log`
Precompiling project...
  Progress [========================================>]  1/1
1 dependency successfully precompiled in 3 seconds (41 already precompiled)

julia> using JuMP, Gurobi

julia> m = Model(Gurobi.Optimizer)
Academic license - for non-commercial use only
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: Gurobi

julia> optimize!(m)     # Note the version!
Gurobi Optimizer version 9.0.3 build v9.0.3rc0 (win64)
Optimize a model with 0 rows, 0 columns and 0 nonzeros
Model fingerprint: 0xf9715da1
Coefficient statistics:
  Matrix range     [0e+00, 0e+00]
  Objective range  [0e+00, 0e+00]
  Bounds range     [0e+00, 0e+00]
  RHS range        [0e+00, 0e+00]
Presolve time: 0.00s
Presolve: All rows and columns removed
Iteration    Objective       Primal Inf.    Dual Inf.      Time
       0    0.0000000e+00   0.000000e+00   0.000000e+00      0s

Solved in 0 iterations and 0.00 seconds
Optimal objective  0.000000000e+00

User-callback calls 19, time in user-callback 0.00 sec

So I figured somehow 9.0.3 was sticking around. I tried renaming the folder C:\Program Files\Gurobi903 so Gurobi.jl couldn't find the 9.0.3 binaries:

(@v1.6) pkg> build Gurobi
    Building Gurobi  `C:\Users\niclas\.julia\scratchspaces\44cfe95a-1eb2-52ea-b672-e2afdf69b78f\e66fa4ef62605be7730aa22832785ad9763e090e\build.log`
Precompiling project...
  Progress [========================================>]  1/1
1 dependency successfully precompiled in 3 seconds (41 already precompiled)

julia> using JuMP, Gurobi

julia> m = Model(Gurobi.Optimizer)
ERROR: could not load library "gurobi90"
The specified module could not be found.
Stacktrace:
  [1] GRBloadenv
    @ ~\.julia\packages\Gurobi\JcjAE\src\gen90\libgrb_api.jl:734 [inlined]
  [2] Gurobi.Env()
    @ Gurobi ~\.julia\packages\Gurobi\JcjAE\src\MOI_wrapper.jl:87
  [3] Gurobi.Optimizer(env::Nothing; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Gurobi ~\.julia\packages\Gurobi\JcjAE\src\MOI_wrapper.jl:241
  [4] Optimizer
    @ ~\.julia\packages\Gurobi\JcjAE\src\MOI_wrapper.jl:239 [inlined]
  [5] _instantiate_and_check(optimizer_constructor::Type{Gurobi.Optimizer})
    @ MathOptInterface ~\.julia\packages\MathOptInterface\5WwpK\src\instantiate.jl:60
  [6] instantiate(optimizer_constructor::Type; with_bridge_type::Type{Float64}, with_names::Bool)
    @ MathOptInterface ~\.julia\packages\MathOptInterface\5WwpK\src\instantiate.jl:116
  [7] set_optimizer(model::Model, optimizer_constructor::Type; bridge_constraints::Bool)
    @ JuMP ~\.julia\packages\JuMP\y5vgk\src\optimizer_interface.jl:75
  [8] Model(optimizer_factory::Type; bridge_constraints::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ JuMP ~\.julia\packages\JuMP\y5vgk\src\JuMP.jl:235
  [9] Model(optimizer_factory::Type)
    @ JuMP ~\.julia\packages\JuMP\y5vgk\src\JuMP.jl:234
 [10] top-level scope
    @ REPL[5]:1

Bizarre. How could Gurobi.jl successfully build and precompile, but then fail at runtime due to not finding the .dll? And why is it insisting on using gurobi90.dll when I have 9.1.1 installed? So I looked through my system again and found some very old Gurobi versions (8.0 and 8.1) still hanging around. When I renamed those folders too then finally everything worked:

(@v1.6) pkg> build Gurobi
    Building Gurobi  `C:\Users\niclas\.julia\scratchspaces\44cfe95a-1eb2-52ea-b672-e2afdf69b78f\e66fa4ef62605be7730aa22832785ad9763e090e\build.log`
  Progress [========================================>]  1/1
1 dependency successfully precompiled in 3 seconds (41 already precompiled)

julia> using JuMP, Gurobi

julia> m = Model(Gurobi.Optimizer)
Academic license - for non-commercial use only - expires 2021-04-16
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: Gurobi

julia> optimize!(m)
Gurobi Optimizer version 9.1.1 build v9.1.1rc0 (win64)
Thread count: 6 physical cores, 12 logical processors, using up to 12 threads
Optimize a model with 0 rows, 0 columns and 0 nonzeros
Model fingerprint: 0xf9715da1
Coefficient statistics:
  Matrix range     [0e+00, 0e+00]
  Objective range  [0e+00, 0e+00]
  Bounds range     [0e+00, 0e+00]
  RHS range        [0e+00, 0e+00]
Presolve time: 0.00s
Presolve: All rows and columns removed
Iteration    Objective       Primal Inf.    Dual Inf.      Time
       0    0.0000000e+00   0.000000e+00   0.000000e+00      0s

Solved in 0 iterations and 0.00 seconds
Optimal objective  0.000000000e+00

User-callback calls 20, time in user-callback 0.00 sec

So it's working for me now but I'm opening an issue in the hope that this could become easier in the future. Specifically I suggest:

  • Gurobi.jl should default to using the lib folder inside GUROBI_HOME and not some other arbitrary folder it manages to pick up from the path.
  • When building, Gurobi.jl should output which folders it's using for binaries and libraries. Then you can tell immediately on install if everything is OK.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant