Gurobi on Julia 1.4

I’m trying to upgrade Julia to 1.4 from 1.3, but Gurobi package is giving me the following error.
Could anybody confirm whether it’s related to my own setting or not? Any comments would be appreciated.

I only have three packages installed:

(@v1.4) pkg> status
Status `~/.julia/environments/v1.4/Project.toml`
  [c52e3926] Atom v0.12.15
  [4076af6c] JuMP v0.21.3
  [e5e0dc1b] Juno v0.8.2

When I try to add Gurobi, it gives me the following error:

(@v1.4) pkg> add Gurobi
   Updating registry at `~/.julia/registries/General`
   Updating git-repo `https://github.com/JuliaRegistries/General.git`
  Resolving package versions...
  Installed MathProgBase ─ v0.7.8
  Installed Gurobi ─────── v0.8.1
   Updating `~/.julia/environments/v1.4/Project.toml`
  [2e9cd046] + Gurobi v0.8.1
   Updating `~/.julia/environments/v1.4/Manifest.toml`
  [2e9cd046] + Gurobi v0.8.1
  [fdba3010] + MathProgBase v0.7.8
   Building Gurobi → `~/.julia/packages/Gurobi/7YNJV/deps/build.log`
┌ Error: Error building `Gurobi`:
│ Gurobi Optimizer version 9.0.2 build v9.0.2rc0 (mac64)
│ Copyright (c) 2020, Gurobi Optimization, LLC
│ ERROR: LoadError: Unable to locate Gurobi installation. If the advice above did not help,
│ open an issue at https://github.com/JuliaOpt/Gurobi.jl and post the full
│ print-out of this diagnostic attempt.
│
│ Stacktrace:
│  [1] error(::String) at ./error.jl:33
│  [2] top-level scope at /Users/singingkim/.julia/packages/Gurobi/7YNJV/deps/build.jl:154
│  [3] include(::String) at ./client.jl:439
│  [4] top-level scope at none:5
│ in expression starting at /Users/singingkim/.julia/packages/Gurobi/7YNJV/deps/build.jl:152
│ Unable to locate Gurobi installation. Running some common diagnostics.
│
│ Gurobi.jl only supports the following versions:
│
│  - gurobi90
│  - gurobi81
│  - gurobi80
│  - gurobi75
│  - gurobi70
│
│ Did you download and install one of these versions from gurobi.com?
│
│
│ Looking for a version of Gurobi in your path:
│
│
│ We couldn't find the `GUROBI_HOME` environment variable, but we
│ found this version of Gurobi on your path. Is this version one of
│ the supported versions listed above? If not, you should edit your
│ `PATH` to point to the correct version.
└ @ Pkg.Operations /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Pkg/src/Operations.jl:899

That is super weird. It looks like it found Gurobi but then it didn’t?

Where is your Gurobi installed? Try setting the GUROBI_HOME environment variable to /Library/gurobi902/mac64 (or equivalent, depending on where you installed it).

What is the output of

using Libdl
Libdl.dlopen("libgurobi90.dylib")

I just tried and got almost the same error, but in my case I don’t see any traces of downloading/building Gurobi (see below)

@SingingKim can you try to download it from gurobi.com manually?

┌ Error: Error building `Gurobi`:
│ ERROR: LoadError: Unable to locate Gurobi installation. If the advice above did not help,
│ open an issue at https://github.com/JuliaOpt/Gurobi.jl and post the full
│ print-out of this diagnostic attempt.
│
│ Stacktrace:
│  [1] error(::String) at /Applications/Julia-1.4.app/Contents/Resources/julia/lib/julia/sys.dylib:?
│  [2] top-level scope at /Users/tamasgal/.julia/packages/Gurobi/7YNJV/deps/build.jl:154
│  [3] include(::String) at /Applications/Julia-1.4.app/Contents/Resources/julia/lib/julia/sys.dylib:?
│  [4] top-level scope at none:5
│ in expression starting at /Users/tamasgal/.julia/packages/Gurobi/7YNJV/deps/build.jl:152
│ Unable to locate Gurobi installation. Running some common diagnostics.
│ Gurobi.jl only supports the following versions:
│
│  - gurobi90
│  - gurobi81
│  - gurobi80
│  - gurobi75
│  - gurobi70
│
│ Did you download and install one of these versions from gurobi.com?

It’s very odd as it works just fine on Julia 1.3.
Can you let me know how to set an environment variable?

Gurobi installation location: /Library/gurobi902/

julia> using Libdl

julia> Libdl.dlopen("libgurobi90.dylib")
ERROR: could not load library "libgurobi90.dylib"
dlopen(libgurobi90.dylib, 1): image not found
Stacktrace:
 [1] dlopen(::String, ::UInt32; throw_error::Bool) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Libdl/src/Libdl.jl:109
 [2] dlopen at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Libdl/src/Libdl.jl:109 [inlined] (repeats 2 times)
 [3] top-level scope at REPL[10]:1

Yes, I downloaded Gurobi from their webpage and added my license key.

Try

ENV["GUROBI_HOME"] = "/Library/gurobi902/mac64"
] build Gurobi
1 Like

It worked! Thanks a lot for helping me.

Oscar, let me ask you one more similar question.

Ipopt with HSL gives me the following error:

using JuMP, Ipopt
m = Model(Ipopt.Optimizer)
set_optimizer_attribute(m, "linear_solver", "ma86")
@variable(m, x <= 5)
JuMP.optimize!(m)
Exception of type: OPTION_INVALID in file "IpAlgBuilder.cpp" at line 349:
 Exception message: Selected linear solver HSL_MA86 not available.
Tried to obtain HSL_MA86 from shared library "libhsl.dylib", but the following error occured:
dlopen(libhsl.dylib, 2): image not found

However, it also works fine with Julia 1.3.
(Your renaming solution (libcoinhsl.dylib->libhsl.dylib) fixed my previous issue with Julia 1.3.).

Do you have any idea how to fix this for Julia 1.4?

No, I don’t know. You need to have the libhsl.dylib library somewhere you can dlopen it. I’m not sure why changing from 1.3 to 1.4 would change that.

1 Like

I see. Thanks for your help!