Gurobi fails to precompile

I am trying to run a file, but when I try to run the code Gurobi fails to precompile. The error output is at the end of the post. I have tried the suggested fix in the output:

using Pkg; Pkg.instantiate()

but I still receive the error. If I try

Gurobi.Env()

I get:

Set parameter Username
Academic license - for non-commercial use only - expires 2025-01-30
Gurobi.Env(Ptr{Nothing} @0x00007fbd87f6ce00, false, 0)

Here is the error I receive from running the code:

Precompiling Gurobi...
Info Given Gurobi was explicitly requested, output will be shown live 
ERROR: LoadError: InitError: Artifact "Gurobi" was not found by looking in the paths:
  ~/.julia/artifacts/4f276549146c3ac663c68db6fc5496497cdbd50a
  ~/.julia/juliaup/julia-1.11.0+0.aarch64.apple.darwin14/local/share/julia/artifacts/4f276549146c3ac663c68db6fc5496497cdbd50a
  ~/.julia/juliaup/julia-1.11.0+0.aarch64.apple.darwin14/share/julia/artifacts/4f276549146c3ac663c68db6fc5496497cdbd50a
Try `using Pkg; Pkg.instantiate()` to re-install all missing resources if the artifact is part of a package or call `Pkg.ensure_artifact_installed` (https://pkgdocs.julialang.org/v1/api/#Pkg.Artifacts.ensure_artifact_installed) if not.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] _artifact_str(__module__::Module, artifacts_toml::String, name::SubString{String}, path_tail::String, artifact_dict::Dict{String, Any}, hash::Base.SHA1, platform::Base.BinaryPlatforms.Platform, lazyartifacts::Any)
    @ Artifacts ~/.julia/juliaup/julia-1.11.0+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Artifacts/src/Artifacts.jl:588
  [3] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::@Kwargs{})
    @ Base ./essentials.jl:1054
  [4] invokelatest(::Any, ::Any, ::Vararg{Any})
    @ Base ./essentials.jl:1051
  [5] macro expansion
    @ ~/.julia/juliaup/julia-1.11.0+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Artifacts/src/Artifacts.jl:717 [inlined]
  [6] find_artifact_dir()
    @ Gurobi_jll ~/.julia/packages/JLLWrappers/inPJn/src/wrapper_generators.jl:17
  [7] __init__()
    @ Gurobi_jll ~/.julia/packages/Gurobi_jll/QGjvN/src/wrappers/aarch64-apple-darwin.jl:17
  [8] run_module_init(mod::Module, i::Int64)
    @ Base ./loading.jl:1336
  [9] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1324
 [10] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any}, ignore_native::Nothing; register::Bool)
    @ Base ./loading.jl:1213
 [11] _include_from_serialized (repeats 2 times)
    @ ./loading.jl:1169 [inlined]
 [12] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128, stalecheck::Bool; reasons::Dict{String, Int64}, DEPOT_PATH::Vector{String})
    @ Base ./loading.jl:1975
 [13] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:2435
 [14] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:2300
 [15] #invoke_in_world#3
    @ ./essentials.jl:1088 [inlined]
 [16] invoke_in_world
    @ ./essentials.jl:1085 [inlined]
 [17] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:2287
 [18] macro expansion
    @ ./loading.jl:2226 [inlined]
 [19] macro expansion
    @ ./lock.jl:273 [inlined]
 [20] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:2183
 [21] #invoke_in_world#3
    @ ./essentials.jl:1088 [inlined]
 [22] invoke_in_world
    @ ./essentials.jl:1085 [inlined]
 [23] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:2176
 [24] top-level scope
    @ ~/.julia/packages/Gurobi/8rQku/src/Gurobi.jl:17
 [25] include
    @ ./Base.jl:557 [inlined]
 [26] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
    @ Base ./loading.jl:2806
 [27] top-level scope
    @ stdin:4
during initialization of module Gurobi_jll
in expression starting at /Users/benjaminhamlin/.julia/packages/Gurobi/8rQku/src/Gurobi.jl:7
in expression starting at stdin:4
  ✗ SpecialFunctions
  ✗ CodecBzip2
  ✗ ForwardDiff
  ✗ MathOptInterface
  ✗ Gurobi
  0 dependencies successfully precompiled in 35 seconds. 59 already precompiled.

ERROR: LoadError: The following 1 direct dependency failed to precompile:

Gurobi 

Failed to precompile Gurobi [2e9cd046-0924-5485-92f1-d5272153d98b] to "/Users/benjaminhamlin/.julia/compiled/v1.11/Gurobi/jl_sVPxE9".
ERROR: LoadError: InitError: Artifact "Gurobi" was not found by looking in the paths:
  ~/.julia/artifacts/4f276549146c3ac663c68db6fc5496497cdbd50a
  ~/.julia/juliaup/julia-1.11.0+0.aarch64.apple.darwin14/local/share/julia/artifacts/4f276549146c3ac663c68db6fc5496497cdbd50a
  ~/.julia/juliaup/julia-1.11.0+0.aarch64.apple.darwin14/share/julia/artifacts/4f276549146c3ac663c68db6fc5496497cdbd50a
Try `using Pkg; Pkg.instantiate()` to re-install all missing resources if the artifact is part of a package or call `Pkg.ensure_artifact_installed` (https://pkgdocs.julialang.org/v1/api/#Pkg.Artifacts.ensure_artifact_installed) if not.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] _artifact_str(__module__::Module, artifacts_toml::String, name::SubString{String}, path_tail::String, artifact_dict::Dict{String, Any}, hash::Base.SHA1, platform::Base.BinaryPlatforms.Platform, lazyartifacts::Any)
    @ Artifacts ~/.julia/juliaup/julia-1.11.0+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Artifacts/src/Artifacts.jl:588
  [3] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::@Kwargs{})
    @ Base ./essentials.jl:1054
  [4] invokelatest(::Any, ::Any, ::Vararg{Any})
    @ Base ./essentials.jl:1051
  [5] macro expansion
    @ ~/.julia/juliaup/julia-1.11.0+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Artifacts/src/Artifacts.jl:717 [inlined]
  [6] find_artifact_dir()
    @ Gurobi_jll ~/.julia/packages/JLLWrappers/inPJn/src/wrapper_generators.jl:17
  [7] __init__()
    @ Gurobi_jll ~/.julia/packages/Gurobi_jll/QGjvN/src/wrappers/aarch64-apple-darwin.jl:17
  [8] run_module_init(mod::Module, i::Int64)
    @ Base ./loading.jl:1336
  [9] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1324
 [10] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any}, ignore_native::Nothing; register::Bool)
    @ Base ./loading.jl:1213
 [11] _include_from_serialized (repeats 2 times)
    @ ./loading.jl:1169 [inlined]
 [12] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128, stalecheck::Bool; reasons::Dict{String, Int64}, DEPOT_PATH::Vector{String})
    @ Base ./loading.jl:1975
 [13] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:2435
 [14] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:2300
 [15] #invoke_in_world#3
    @ ./essentials.jl:1088 [inlined]
 [16] invoke_in_world
    @ ./essentials.jl:1085 [inlined]
 [17] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:2287
 [18] macro expansion
    @ ./loading.jl:2226 [inlined]
 [19] macro expansion
    @ ./lock.jl:273 [inlined]
 [20] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:2183
 [21] #invoke_in_world#3
    @ ./essentials.jl:1088 [inlined]
 [22] invoke_in_world
    @ ./essentials.jl:1085 [inlined]
 [23] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:2176
 [24] top-level scope
    @ ~/.julia/packages/Gurobi/8rQku/src/Gurobi.jl:17
 [25] include
    @ ./Base.jl:557 [inlined]
 [26] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
    @ Base ./loading.jl:2806
 [27] top-level scope
    @ stdin:4
during initialization of module Gurobi_jll
in expression starting at /Users/benjaminhamlin/.julia/packages/Gurobi/8rQku/src/Gurobi.jl:7
in expression starting at stdin:
in expression starting at /Users/benjaminhamlin/Visual_Studio/SDDP_Experiments/gurobi.jl:11
in expression starting at /Users/benjaminhamlin/Visual_Studio/SDDP_Experiments/BiObjectiveSDDP.jl:6

See this post:

In particular, please put the stack trace and other output into a Markdown code block.

Hi @bjhamli welcome to the forum :smile:

Your Gurobi.Env() command looks like you have Gurobi installed and working???

What is the output of import Pkg; Pkg.status()?

Uh’oh: I scrolled to the end and saw BiObjectiveSDDP.jl:6. We should discuss more… I don’t really recommend using this code.

Hi. Thank you for the kind welcome.

The status output is:

~/.julia/environments/v1.11/Project.toml`
  [2e9cd046] Gurobi v1.3.1
  [f4570300] SDDP v1.8.1
  [9a3f8284] Random v1.11.0

Oh dear. How should I contact you to discuss this?

Are you on a school or work network with a firewall? I don’t really understand how you’re getting the error message if you have Gurobi working?

How should I contact you to discuss this?

I’ll DM you my email

The university may have a firewall. I have tried it at home and received the same error. I am using a university owned machine, but I’ve had no problems with Gurobi in either Python or MATLAB on the same machine.

My advisor helped me work through it in our meeting today. I did not have a config folder in my .julia folder. We created the config folder, placed the project.toml file there, removed Gurobi, reinstalled it. Now everything seems to be working.