# Getting "MethodError: no method matching Model()" when initializing models on JuMP

**URL:** <https://discourse.julialang.org/t/getting-methoderror-no-method-matching-model-when-initializing-models-on-jump/43647>\
**Category:** Optimization (Mathematical)\
**Tags:** jump, error\
**Created:** [July 24, 2020, 11:39pm UTC](https://discourse.julialang.org/t/getting-methoderror-no-method-matching-model-when-initializing-models-on-jump/43647 "2020-07-24T23:39:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![hassanis](https://avatars.discourse-cdn.com/v4/letter/h/4491bb/32.png) [@hassanis](https://discourse.julialang.org/u/hassanis)\
**Post date:** [July 24, 2020, 11:39pm UTC](https://discourse.julialang.org/t/getting-methoderror-no-method-matching-model-when-initializing-models-on-jump/43647/1 "2020-07-24T23:39:32Z")

</div>

I’m using JuMP and had several models that were running fine. Now, whenever I try to initialize a model (for example `Model(Gurobi.Optimizer)`), I get the error:

```julia
MethodError: no method matching Model(::Type{Gurobi.Optimizer})
Closest candidates are:
  Model(::Any, !Matched::Symbol, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Int64, !Matched::Array{String,1}, !Matched::Array{String,1}, !Matched::Array{Float64,1}, !Matched::Array{Float64,1}, !Matched::Array{Symbol,1}, !Matched::Array{T,1} where T, !Matched::Array{Tuple{Symbol,Any},1}, !Matched::Any, !Matched::Any, !Matched::Array{Float64,1}, !Matched::Array{Float64,1}, !Matched::Array{Float64,1}, !Matched::Array{Float64,1}, !Matched::Array{Array{Int64,1},1}, !Matched::Array{Array{Tuple{Int64,Int64},1},1}, !Matched::Any, !Matched::MathProgBase.SolverInterface.AbstractMathProgSolver, !Matched::Bool, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Array{T,1} where T, !Matched::JuMP.IndexedVector{Float64}, !Matched::Any, !Matched::Bool, !Matched::Dict{Symbol,Any}, !Matched::IdDict, !Matched::Int64, !Matched::Int64, !Matched::Dict{Symbol,Any}) at /Users/Hassan/.julia/packages/JuMP/I7whV/src/JuMP.jl:87
  Model(::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any) at /Users/Hassan/.julia/packages/JuMP/I7whV/src/JuMP.jl:87
  Model(; solver, simplify_nonlinear_expressions) at /Users/Hassan/.julia/packages/JuMP/I7whV/src/JuMP.jl:168
top-level scope at haha.jl:15

```

Note that I had initialized both JuMP & Gurobi (e.g. `using JuMP, Ipopt, Gurobi, LinearAlgebra`) prior to creating the model. I have tried restarting my laptop and updating the packages I’m using, but the error is still there.

Any idea what went wrong? It was working fine… until it wasn’t.

---

<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:** [July 25, 2020, 12:10am UTC](https://discourse.julialang.org/t/getting-methoderror-no-method-matching-model-when-initializing-models-on-jump/43647/2 "2020-07-25T00:10:12Z")

</div>

Looks like you’re using an old version of JuMP.

Check the output of `] status`. But either run `] up`, or try `] add JuMP@0.21` to see why it downgraded. You probably installed an outdated package.

If it doesn’t work, post the output of all these commands and we can see what the problem is.

---

<div class="post-metadata">

**Author:** ![hassanis](https://avatars.discourse-cdn.com/v4/letter/h/4491bb/32.png) [@hassanis](https://discourse.julialang.org/u/hassanis)\
**Post date:** [July 26, 2020, 5:03pm UTC](https://discourse.julialang.org/t/getting-methoderror-no-method-matching-model-when-initializing-models-on-jump/43647/3 "2020-07-26T17:03:41Z")

</div>

Thank you for your reply. I tried adding `] add JuMP@` and got the following error code:

````julia
ERROR: Unsatisfiable requirements detected for package Pajarito [2f354839]:
 Pajarito [2f354839] log:
 ├─possible versions are: [0.6.1, 0.7.0] or uninstalled
 ├─restricted to versions * by an explicit requirement, leaving only versions [0.6.1, 0.7.0]
 └─restricted by compatibility requirements with JuMP [4076af6c] to versions: uninstalled — no versions left
   └─JuMP [4076af6c] log:
     ├─possible versions are: [0.18.3-0.18.6, 0.19.0-0.19.2, 0.20.0-0.20.1, 0.21.0-0.21.3] or uninstalled
     └─restricted to versions 0.21 by an explicit requirement, leaving only versions 0.21.0-0.21.3```

````

I assume something happened when i tried installing `Pajarito.jl`? Any idea how to uninstall it so thhat it doesn’t interfere with JuMP?

Thanks again.

---

<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:** [July 26, 2020, 5:49pm UTC](https://discourse.julialang.org/t/getting-methoderror-no-method-matching-model-when-initializing-models-on-jump/43647/4 "2020-07-26T17:49:52Z")

</div>

`] rm Pajarito`.

---

<div class="post-metadata">

**Author:** ![hassanis](https://avatars.discourse-cdn.com/v4/letter/h/4491bb/32.png) [@hassanis](https://discourse.julialang.org/u/hassanis)\
**Post date:** [July 26, 2020, 6:11pm UTC](https://discourse.julialang.org/t/getting-methoderror-no-method-matching-model-when-initializing-models-on-jump/43647/5 "2020-07-26T18:11:50Z")

</div>

Thank you so much @odow. **JuMP is up and running again**.

For future reference, is there any resource/ way to figure out whether installing a package will cause a similar deprecation?

---

<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:** [July 26, 2020, 7:01pm UTC](https://discourse.julialang.org/t/getting-methoderror-no-method-matching-model-when-initializing-models-on-jump/43647/6 "2020-07-26T19:01:30Z")

</div>

> is there any resource/ way to figure out whether installing a package will cause a similar deprecation?

Not really. We need something like this: [Optionally warn if `update` cannot install latest version of a package · Issue #1655 · JuliaLang/Pkg.jl · GitHub](https://github.com/JuliaLang/Pkg.jl/issues/1655)

See also: [Package versions, how to make it less confusing?](https://discourse.julialang.org/t/package-version-confusion-how-to-make-it-less-confusing/43714)

---

<div class="post-metadata">

**Author:** ![danuzco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danuzco/32/18740_2.png) [@danuzco](https://discourse.julialang.org/u/danuzco)\
**Post date:** [October 18, 2020, 6:43pm UTC](https://discourse.julialang.org/t/getting-methoderror-no-method-matching-model-when-initializing-models-on-jump/43647/7 "2020-10-18T18:43:38Z")

</div>

I had a similar issue

```julia
 add JuMP@0.21
  Resolving package versions...
ERROR: Unsatisfiable requirements detected for package JuMP [4076af6c]:
 JuMP [4076af6c] log:
 ├─possible versions are: [0.18.3-0.18.6, 0.19.0-0.19.2, 0.20.0-0.20.1, 0.21.0-0.21.5] or uninstalled
 ├─restricted to versions 0.21 by an explicit requirement, leaving only versions 0.21.0-0.21.5
 └─restricted by compatibility requirements with ConditionalJuMP [ae04f764] to versions: 0.18.3-0.18.6 — no versions left
   └─ConditionalJuMP [ae04f764] log:
     ├─possible versions are: 0.1.0 or uninstalled
     └─restricted to versions * by an explicit requirement, leaving only versions 0.1.0

```

I solved this by `] rm ConditionalJuMP` and then `add JuMP@0.21.0`

I hope this be useful
