jump-dev / Gurobi.jl

A Julia interface to the Gurobi Optimizer
http://www.gurobi.com/
MIT License
221 stars 80 forks source link

Error building Gurobi #507

Closed oliviagphillips closed 1 year ago

oliviagphillips commented 1 year ago

I was previously using Gurobi with no issues, and then after I imported a new package Gurobi wouldn't load properly, so I decided to uninstall and reinstall everything. However, the issue hasn't resolved, and I'm getting the following error when I try to build Gurobi again:

julia> Pkg.build("Gurobi") Building Gurobi → ~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/aac05324d46b53289ccb05510b05b4a56ffd3ed5/build.log 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/jump-dev/Gurobi.jl and post the full print-out of this diagnostic attempt.

Stacktrace: [1] error(s::String) @ Base ./error.jl:35 [2] top-level scope @ ~/.julia/packages/Gurobi/BAtIN/deps/build.jl:165 [3] include(fname::String) @ Base.MainInclude ./client.jl:476 [4] top-level scope @ none:5 in expression starting at /Users/oliviaphillips/.julia/packages/Gurobi/BAtIN/deps/build.jl:159

Unable to locate Gurobi installation. Running some common diagnostics.

Gurobi.jl only supports the following versions:

  • gurobi91
  • gurobi90

Did you download and install one of these versions from gurobi.com? Installing Gurobi.jl via the Julia package manager is not sufficient!

Found GUROBI_HOME = /Library/gurobi1001/macos_universal2

Does this point to the correct install location?

We're going to look for the Gurobi library in this directory: /Library/gurobi1001/macos_universal2/lib

That directory has the following files:

  • /Library/gurobi1001/macos_universal2/lib/gurobi-javadoc.jar
  • /Library/gurobi1001/macos_universal2/lib/gurobi.jar
  • /Library/gurobi1001/macos_universal2/lib/gurobi.py
  • /Library/gurobi1001/macos_universal2/lib/gurobi100.netstandard20.dll
  • /Library/gurobi1001/macos_universal2/lib/gurobi100.netstandard20.xml
  • /Library/gurobi1001/macos_universal2/lib/libGurobiJni100.jnilib
  • /Library/gurobi1001/macos_universal2/lib/libgurobi100.dylib
  • /Library/gurobi1001/macos_universal2/lib/libgurobi100_light.dylib
  • /Library/gurobi1001/macos_universal2/lib/libgurobi_c++.a
  • /Library/gurobi1001/macos_universal2/lib/python3.10
  • /Library/gurobi1001/macos_universal2/lib/python3.11
  • /Library/gurobi1001/macos_universal2/lib/python3.7
  • /Library/gurobi1001/macos_universal2/lib/python3.8
  • /Library/gurobi1001/macos_universal2/lib/python3.9
  • /Library/gurobi1001/macos_universal2/lib/rootcert.pem

We were looking for (but could not find) a file named like libgurobiXXX.so, libgurobiXXX.dylib, or gurobiXXX.dll.

You should set the GUROBI_HOME environment variable to point to the install location then try again. For example (updating the path to the correct location if needed):

# On Windows, this might be
ENV["GUROBI_HOME"] = "C:\\Program Files\\gurobi910\\win64\\"
import Pkg
Pkg.add("Gurobi")
Pkg.build("Gurobi")

# On OSX, this might be
ENV["GUROBI_HOME"] = "/Library/gurobi910/mac64/"
import Pkg
Pkg.add("Gurobi")
Pkg.build("Gurobi")

# On Unix, this might be
ENV["GUROBI_HOME"] = "/opt/gurobi910/linux64/"
import Pkg
Pkg.add("Gurobi")
Pkg.build("Gurobi")

Note: your path may differ. Check which folder you installed the Gurobi binary in, and update the path accordingly.

Stacktrace: [1] pkgerror(msg::String) @ Pkg.Types /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Types.jl:67 [2] (::Pkg.Operations.var"#66#73"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String})() @ Pkg.Operations /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:1060 [3] withenv(::Pkg.Operations.var"#66#73"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String}, ::Pair{String, String}, ::Vararg{Pair{String}}) @ Base ./env.jl:172 [4] (::Pkg.Operations.var"#107#112"{String, Bool, Bool, Bool, Pkg.Operations.var"#66#73"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String}, Pkg.Types.PackageSpec})() @ Pkg.Operations /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:1619 [5] with_temp_env(fn::Pkg.Operations.var"#107#112"{String, Bool, Bool, Bool, Pkg.Operations.var"#66#73"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String}, Pkg.Types.PackageSpec}, temp_env::String) @ Pkg.Operations /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:1493 [6] (::Pkg.Operations.var"#105#110"{Dict{String, Any}, Bool, Bool, Bool, Pkg.Operations.var"#66#73"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String}, Pkg.Types.Context, Pkg.Types.PackageSpec, String, Pkg.Types.Project, String})(tmp::String) @ Pkg.Operations /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:1582 [7] mktempdir(fn::Pkg.Operations.var"#105#110"{Dict{String, Any}, Bool, Bool, Bool, Pkg.Operations.var"#66#73"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String}, Pkg.Types.Context, Pkg.Types.PackageSpec, String, Pkg.Types.Project, String}, parent::String; prefix::String) @ Base.Filesystem ./file.jl:764 [8] mktempdir(fn::Function, parent::String) (repeats 2 times) @ Base.Filesystem ./file.jl:760 [9] sandbox(fn::Function, ctx::Pkg.Types.Context, target::Pkg.Types.PackageSpec, target_path::String, sandbox_path::String, sandbox_project_override::Pkg.Types.Project; preferences::Dict{String, Any}, force_latest_compatible_version::Bool, allow_earlier_backwards_compatible_versions::Bool, allow_reresolve::Bool) @ Pkg.Operations /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:1540 [10] build_versions(ctx::Pkg.Types.Context, uuids::Set{Base.UUID}; verbose::Bool) @ Pkg.Operations /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:1041 [11] build(ctx::Pkg.Types.Context, uuids::Set{Base.UUID}, verbose::Bool) @ Pkg.Operations /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:898 [12] build(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; verbose::Bool, kwargs::Base.Pairs{Symbol, Base.TTY, Tuple{Symbol}, NamedTuple{(:io,), Tuple{Base.TTY}}}) @ Pkg.API /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:1029 [13] build(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ Pkg.API /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:156 [14] build(pkgs::Vector{Pkg.Types.PackageSpec}) @ Pkg.API /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:145 [15] #build#99 @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:144 [inlined] [16] build @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:144 [inlined] [17] #build#98 @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:143 [inlined] [18] build(pkg::String) @ Pkg.API /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:143 [19] top-level scope @ REPL[4]:1

odow commented 1 year ago

What is import Pkg; Pkg.status()? It looks like you have installed an old version of Gurobi.jl.

Try import Pkg; Pkg.pkg"add Gurobi@1".

oliviagphillips commented 1 year ago

Ok it seems like things aren't up to date, but I'm not sure what to do now. I've attached the readouts after trying both of those commands.

Screenshot 2023-03-29 at 4 19 18 PM Screenshot 2023-03-29 at 4 19 48 PM

(followed by the Stacktrace)

odow commented 1 year ago

Uninstall LightGraphsMatching with import Pkg; Pkg.rm("LightGraphsMatching"), then run import Pkg; Pkg.update().

The package is deprecated and unsupported: https://github.com/JuliaGraphs/LightGraphsMatching.jl

oliviagphillips commented 1 year ago

Gotcha! Ok after doing that, when I run using Gurobi I get the following:

Screenshot 2023-03-29 at 4 47 54 PM Screenshot 2023-03-29 at 4 48 11 PM

Is this ok? Or do I need to fix something else as well?

odow commented 1 year ago

Try restarting Julia, then run import Pkg; Pkg.update() again. But it looks like it installed the correct version this time.

odow commented 1 year ago

Closing as stale. Things should work fine if you restart Julia.

Please post on Discourse, https://discourse.julialang.org/c/domain/opt/13, if you run into more issues.