# Gurobi- failed to precompile

**URL:** <https://discourse.julialang.org/t/gurobi-failed-to-precompile/44606>\
**Category:** Optimization (Mathematical)\
**Created:** [August 9, 2020, 7:30am UTC](https://discourse.julialang.org/t/gurobi-failed-to-precompile/44606 "2020-08-09T07:30:26Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![MJMB](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mjmb/32/17613_2.png) [@MJMB](https://discourse.julialang.org/u/MJMB)\
**Post date:** [August 9, 2020, 7:30am UTC](https://discourse.julialang.org/t/gurobi-failed-to-precompile/44606/1 "2020-08-09T07:30:26Z")

</div>

Hello,

I have problem with gurobi, i am using MacBook Pro and suddenly it show me error that it failed to precompile, i have tried to remove it and add it again but it doesn’t work. my license is valid and i am using Gurobi Optimizer version v.0.8.0  
Below is the error

┌ 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](https://github.com/JuliaOpt/Gurobi.jl) and post the full  
│ print-out of this diagnostic attempt.  
│  
│ Stacktrace:  
│ [1] error(::String) at /Applications/JuliaPro-1.4.0-1.app/Contents/Resources/julia/Contents/Resources/julia/lib/julia/sys.dylib:?  
│ [2] top-level scope at /Users/Moh/.juliapro/JuliaPro\_v1.4.0-1/packages/Gurobi/7YNJV/deps/build.jl:154  
│ [3] include(::String) at /Applications/JuliaPro-1.4.0-1.app/Contents/Resources/julia/Contents/Resources/julia/lib/julia/sys.dylib:?  
│ [4] top-level scope at none:5  
│ [5] eval(::Module, ::Any) at /Applications/JuliaPro-1.4.0-1.app/Contents/Resources/julia/Contents/Resources/julia/lib/julia/sys.dylib:?  
│ [6] exec\_options(::Base.JLOptions) at /Applications/JuliaPro-1.4.0-1.app/Contents/Resources/julia/Contents/Resources/julia/lib/julia/sys.dylib:?  
│ [7] \_start() at /Applications/JuliaPro-1.4.0-1.app/Contents/Resources/julia/Contents/Resources/julia/lib/julia/sys.dylib:?  
│ in expression starting at /Users/Moh/.juliapro/JuliaPro\_v1.4.0-1/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](http://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/vagrant/worker/juliapro-release-osx1011-0\_6/build/tmp\_julia/Julia-1.4.app/Contents/Resources/julia/share/julia/stdlib/v1.4/Pkg/src/Operations.jl:892  
[Info: Precompiling Gurobi [2e9cd046-0924-5485-92f1-d5272153d98b]  
ERROR: LoadError: Gurobi not properly installed. Please run Pkg.build(“Gurobi”). For  
more information go to [https://github.com/JuliaOpt/Gurobi.jl](https://github.com/JuliaOpt/Gurobi.jl)

---

<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:** [August 9, 2020, 1:11pm UTC](https://discourse.julialang.org/t/gurobi-failed-to-precompile/44606/2 "2020-08-09T13:11:21Z")

</div>

This is weird. It managed to find Gurobi 9.0.2 on your path, but not the dylib.

Try (assuming this is where you installed Gurobi)

```julia
julia> ENV["GUROBI_HOME"] = "/Library/gurobi902/mac64"

julia> import Pkg; Pkg.build("Gurobi")

```

---

<div class="post-metadata">

**Author:** ![MJMB](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mjmb/32/17613_2.png) [@MJMB](https://discourse.julialang.org/u/MJMB)\
**Post date:** [August 17, 2020, 4:40am UTC](https://discourse.julialang.org/t/gurobi-failed-to-precompile/44606/3 "2020-08-17T04:40:36Z")

</div>

> [@odow](#):
>
> `import Pkg; Pkg.build("Gurobi")`

Yah i have tried everything it shows me this error Unable to locate Gurobi installation. It was working fine but suddenly this issue appear

---

<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:** [August 17, 2020, 5:02am UTC](https://discourse.julialang.org/t/gurobi-failed-to-precompile/44606/4 "2020-08-17T05:02:54Z")

</div>

Did you try the `GUROBI_HOME` thing? What is the output of the error message?

---

<div class="post-metadata">

**Author:** ![MJMB](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mjmb/32/17613_2.png) [@MJMB](https://discourse.julialang.org/u/MJMB)\
**Post date:** [August 17, 2020, 5:12am UTC](https://discourse.julialang.org/t/gurobi-failed-to-precompile/44606/5 "2020-08-17T05:12:03Z")

</div>

For the ENV[“GUROBI\_HOME”] = “/Library/gurobi902/mac64” the output is the same there is no error but when i run gurobi it show me the below error

[Info: Precompiling Gurobi [2e9cd046-0924-5485-92f1-d5272153d98b]  
ERROR: LoadError: Gurobi not properly installed. Please run Pkg.build(“Gurobi”). For  
more information go to [https://github.com/JuliaOpt/Gurobi.jl](https://github.com/JuliaOpt/Gurobi.jl)

Stacktrace:  
[1] error(::String) at /Applications/JuliaPro-1.4.0-1.app/Contents/Resources/julia/Contents/Resources/julia/lib/julia/sys.dylib:?  
[2] top-level scope at /Users/mohammedbushlaibi/.juliapro/JuliaPro\_v1.4.0-1/packages/Gurobi/7YNJV/src/Gurobi.jl:7  
[3] include(::Module, ::String) at /Applications/JuliaPro-1.4.0-1.app/Contents/Resources/julia/Contents/Resources/julia/lib/julia/sys.dylib:?  
[4] top-level scope at none:2  
[5] eval at ./boot.jl:331 [inlined]  
in expression starting at /Users/mohammedbushlaibi/.juliapro/JuliaPro\_v1.4.0-1/packages/Gurobi/7YNJV/src/Gurobi.jl:4

---

<div class="post-metadata">

**Author:** ![zlq178](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zlq178/32/17952_2.png) [@zlq178](https://discourse.julialang.org/u/zlq178)\
**Post date:** [April 23, 2021, 10:55am UTC](https://discourse.julialang.org/t/gurobi-failed-to-precompile/44606/6 "2021-04-23T10:55:47Z")

</div>

How did you solve this error?

---

<div class="post-metadata">

**Author:** ![MAHENDRA\_KUMAWAT](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mahendra_kumawat/32/32180_2.png) [@MAHENDRA\_KUMAWAT](https://discourse.julialang.org/u/MAHENDRA_KUMAWAT)\
**Post date:** [June 13, 2022, 9:29am UTC](https://discourse.julialang.org/t/gurobi-failed-to-precompile/44606/7 "2022-06-13T09:29:46Z")

</div>

how did you solve it?

---

<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:** [June 14, 2022, 3:23am UTC](https://discourse.julialang.org/t/gurobi-failed-to-precompile/44606/8 "2022-06-14T03:23:29Z")

</div>

@MAHENDRA_KUMAWAT if you have trouble installing Gurobi, please make a new post, and include the full output of the error message.

---

<div class="post-metadata">

**Author:** ![Pingping1997](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pingping1997/32/44230_2.png) [@Pingping1997](https://discourse.julialang.org/u/Pingping1997)\
**Post date:** [November 8, 2022, 4:18pm UTC](https://discourse.julialang.org/t/gurobi-failed-to-precompile/44606/9 "2022-11-08T16:18:49Z")

</div>

I also had same problem in win64. But after trying

julia\>Pkg.build(“Gurobi”)

it works!

At the beginning I used the latest version of Gurobi is not 9.0, 9,1 or 9.5. So I changed it to 9.5 version.

But following the below command, it always had the error of “ERROR: Failed to precompile Gurobi [2e9cd046-0924-5485-92f1-d5272153d98b]”  
julia\> ENV[“GUROBI\_HOME”] =  
“C:\Program Files\gurobi910\win64”  
julia\> using Pkg  
julia\> Pkg.add(“Gurobi”)

but after adding julia\>Pkg.build(“Gurobi”), the problem was solved.

---

<div class="post-metadata">

**Author:** ![akulbansal5](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@akulbansal5](https://discourse.julialang.org/u/akulbansal5)\
**Post date:** [January 13, 2023, 4:47am UTC](https://discourse.julialang.org/t/gurobi-failed-to-precompile/44606/10 "2023-01-13T04:47:40Z")

</div>

In my case, I first removed the Gurobi package from Julia, then re-installed Gurobi (without deleting the existing version). Then followed the routine (make sure you get the version number right):

ENV[“GUROBI\_HOME”] = “/Library/gurobi912/mac64/”  
import Pkg  
Pkg.add(“Gurobi”)  
Pkg.build(“Gurobi”)

This worked.
