Fail to precompiling JuMP

I’m using these packages:

using JuMP, Distributions, MathProgBase, Ipopt, JuMPChance
using Gurobi

[ Info: Precompiling JuMP [4076af6c-e467-56ae-b986-b466b2749572]
ERROR: LoadError: UndefVarError: `Grisu` not defined
Stacktrace:
 [1] getproperty(x::Module, f::Symbol)
   @ Base .\Base.jl:31
 [2] top-level scope
   @ C:\Users\96906\.julia\packages\JuMP\I7whV\src\writers.jl:6
 [3] include(mod::Module, _path::String)
   @ Base .\Base.jl:457
 [4] include(x::String)
   @ JuMP C:\Users\96906\.julia\packages\JuMP\I7whV\src\JuMP.jl:11
 [5] top-level scope
   @ C:\Users\96906\.julia\packages\JuMP\I7whV\src\JuMP.jl:947
 [6] include
   @ .\Base.jl:457 [inlined]
 [7] 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::String)
   @ Base .\loading.jl:2049
 [8] top-level scope
   @ stdin:3
in expression starting at C:\Users\96906\.julia\packages\JuMP\I7whV\src\writers.jl:5
in expression starting at C:\Users\96906\.julia\packages\JuMP\I7whV\src\JuMP.jl:11
in expression starting at stdin:3
ERROR: Failed to precompile JuMP [4076af6c-e467-56ae-b986-b466b2749572] to "C:\\Users\\96906\\.julia\\compiled\\v1.9\\JuMP\\jl_88C8.tmp".
Stacktrace:
  [1] error(s::String)
    @ Base .\error.jl:35
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
    @ Base .\loading.jl:2294
  [3] compilecache
    @ .\loading.jl:2167 [inlined]
  [4] _require(pkg::Base.PkgId, env::String)
    @ Base .\loading.jl:1805
  [5] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base .\loading.jl:1660
  [6] macro expansion
    @ .\loading.jl:1648 [inlined]
  [7] macro expansion
    @ .\lock.jl:267 [inlined]
  [8] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:1611
  [9] eval
    @ .\boot.jl:370 [inlined]
 [10] include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String)
    @ Base .\loading.jl:1903
 [11] include_string(m::Module, txt::String, fname::String)
    @ Base .\loading.jl:1913
 [12] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base .\essentials.jl:819
 [13] invokelatest(::Any, ::Any, ::Vararg{Any})
    @ Base .\essentials.jl:816
 [14] inlineeval(m::Module, code::String, code_line::Int64, code_column::Int64, file::String; softscope::Bool)
    @ VSCodeServer c:\Users\96906\.vscode\extensions\julialang.language-julia-1.75.2\scripts\packages\VSCodeServer\src\eval.jl:263
 [15] (::VSCodeServer.var"#67#72"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
    @ VSCodeServer c:\Users\96906\.vscode\extensions\julialang.language-julia-1.75.2\scripts\packages\VSCodeServer\src\eval.jl:181
 [16] withpath(f::VSCodeServer.var"#67#72"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams}, path::String)
    @ VSCodeServer c:\Users\96906\.vscode\extensions\julialang.language-julia-1.75.2\scripts\packages\VSCodeServer\src\repl.jl:274
 [17] (::VSCodeServer.var"#66#71"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
    @ VSCodeServer c:\Users\96906\.vscode\extensions\julialang.language-julia-1.75.2\scripts\packages\VSCodeServer\src\eval.jl:179
 [18] hideprompt(f::VSCodeServer.var"#66#71"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})
    @ VSCodeServer c:\Users\96906\.vscode\extensions\julialang.language-julia-1.75.2\scripts\packages\VSCodeServer\src\repl.jl:38
 [19] (::VSCodeServer.var"#65#70"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
    @ VSCodeServer c:\Users\96906\.vscode\extensions\julialang.language-julia-1.75.2\scripts\packages\VSCodeServer\src\eval.jl:150
 [20] with_logstate(f::Function, logstate::Any)
    @ Base.CoreLogging .\logging.jl:514
 [21] with_logger
    @ .\logging.jl:626 [inlined]
 [22] (::VSCodeServer.var"#64#69"{VSCodeServer.ReplRunCodeRequestParams})()
    @ VSCodeServer c:\Users\96906\.vscode\extensions\julialang.language-julia-1.75.2\scripts\packages\VSCodeServer\src\eval.jl:255
 [23] #invokelatest#2
    @ .\essentials.jl:819 [inlined]
 [24] invokelatest(::Any)
    @ Base .\essentials.jl:816
 [25] macro expansion
    @ c:\Users\96906\.vscode\extensions\julialang.language-julia-1.75.2\scripts\packages\VSCodeServer\src\eval.jl:34 [inlined]
 [26] (::VSCodeServer.var"#62#63")()
    @ VSCodeServer .\task.jl:514
julia> Pkg.status()
Status `C:\Users\96906\.julia\environments\v1.9\Project.toml`
  [336ed68f] CSV v0.10.13
  [aaaa29a8] Clustering v0.15.7
⌃ [a93c6f00] DataFrames v0.21.8
⌅ [31c24e10] Distributions v0.21.12
  [42e2da0e] Grisu v1.0.2
⌃ [2e9cd046] Gurobi v0.9.14
⌃ [b6b21f68] Ipopt v0.7.0
⌅ [4076af6c] JuMP v0.18.6
  [bbd82366] JuMPChance v0.5.0
⌅ [b8f27783] MathOptInterface v0.9.22
  [fdba3010] MathProgBase v0.7.8
⌅ [6405355b] Mosek v1.2.3
⌃ [1ec41992] MosekTools v0.9.4
⌅ [91a5bcdd] Plots v1.35.2
⌃ [c36e90e8] PowerModels v0.9.8
  [37e2e46d] LinearAlgebra
  [2f01184e] SparseArrays
  [10745b16] Statistics v1.9.0
Info Packages marked with ⌃ and ⌅ have new versions available. Those with ⌃ may be upgradable, but those with ⌅ are restricted by compatibility constraints from upgrading. To see why use `status --outdated`
(@v1.9) pkg> status --outdated
Status `C:\Users\96906\.julia\environments\v1.9\Project.toml`
⌃ [a93c6f00] DataFrames v0.21.8 (<v1.6.1)
⌅ [31c24e10] Distributions v0.21.12 (<v0.25.107): JuMPChance
⌃ [2e9cd046] Gurobi v0.9.14 (<v1.2.2)
⌃ [b6b21f68] Ipopt v0.7.0 (<v1.6.2)
⌅ [4076af6c] JuMP v0.18.6 (<v1.20.0): InfrastructureModels, JuMPChance, PowerModels
⌅ [b8f27783] MathOptInterface v0.9.22 (<v1.27.0): ECOS, Gurobi, Ipopt, MosekTools
⌅ [6405355b] Mosek v1.2.3 (<v10.1.4): MosekTools
⌃ [1ec41992] MosekTools v0.9.4 (<v0.15.1)
⌅ [91a5bcdd] Plots v1.35.2 (<v1.40.2): julia
⌃ [c36e90e8] PowerModels v0.9.8 (<v0.21.0)

Do you need all these packages for your current project?

If yes, did you try to run

using Pkg
Pkg.update()

?

Notice that you have JuMP 0.18 installed which is nearly 6 years old. The problem is JuMPChance which is old and and unmaintained. I wouldn’t recommend using it. If you must, then downgrade to Julia 1.0; it looks like you’re using Julia 1.9.