# Can't run JuMP sample code

**URL:** <https://discourse.julialang.org/t/cant-run-jump-sample-code/2015>\
**Category:** Optimization (Mathematical)\
**Created:** [February 10, 2017, 12:14am UTC](https://discourse.julialang.org/t/cant-run-jump-sample-code/2015 "2017-02-10T00:14:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arrigo\_Benedetti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/arrigo_benedetti/32/25545_2.png) [@Arrigo\_Benedetti](https://discourse.julialang.org/u/Arrigo_Benedetti)\
**Post date:** [February 10, 2017, 12:14am UTC](https://discourse.julialang.org/t/cant-run-jump-sample-code/2015/1 "2017-02-10T00:14:38Z")

</div>

I am trying to run the MLE sample code from the JuMP documentation at the bottom of this message under Windows. With Julia 0.5.0 I get this error

```julia
ERROR: LoadError: ReadOnlyMemoryError()
 in solveProblem(::Ipopt.IpoptProblem) at C:\Users\arbenede\.julia\v0.5\Ipopt\src\Ipopt.jl:304
 in optimize!(::Ipopt.IpoptMathProgModel) at C:\Users\arbenede\.julia\v0.5\Ipopt\src\IpoptSolverInterface.jl:120
 in #solvenlp#150(::Bool, ::Function, ::JuMP.Model, ::JuMP.ProblemTraits) at C:\Users\arbenede\.julia\v0.5\JuMP\src\nlp.jl:1208
 in (::JuMP.#kw##solvenlp)(::Array{Any,1}, ::JuMP.#solvenlp, ::JuMP.Model, ::JuMP.ProblemTraits) at .\<missing>:0
 in #solve#97(::Bool, ::Bool, ::Bool, ::Array{Any,1}, ::Function, ::JuMP.Model) at C:\Users\arbenede\.julia\v0.5\JuMP\src\solvers.jl:139
 in solve(::JuMP.Model) at C:\Users\arbenede\.julia\v0.5\JuMP\src\solvers.jl:117
 in include_from_node1(::String) at .\loading.jl:488
 in process_options(::Base.JLOptions) at .\client.jl:262
 in _start() at .\client.jl:318
while loading C:\Users\arbenede\Documents\projects\BayesDGsep\julia\test_JuMP.jl, in expression starting on line 17

```

and with 0.6.0-dev I get

```julia
ERROR: LoadError: LoadError: LoadError: invalid subtyping in definition of JuMPArray
Stacktrace:
 [1] include_from_node1(::String) at .\loading.jl:539
 [2] include(::String) at .\sysimg.jl:14
 [3] include_from_node1(::String) at .\loading.jl:539
 [4] include(::String) at .\sysimg.jl:14
 [5] include_from_node1(::String) at .\loading.jl:539
 [6] include(::String) at .\sysimg.jl:14
 [7] anonymous at .\<missing>:2

```

Apparently both errors are known. Is there any combination of Julia version and JuMP solver that works under Windows?

Thanks

-Arrigo

```julia
using JuMP

n = 1000
data = randn(n)

m = Model()

@variable(m, μ, start = 0.0)
@variable(m, σ >= 0.0, start = 1.0)

@NLobjective(m, Max, (n/2)*log(1/(2π*σ^2))-sum((data[i]-μ)^2 for i=1:n)/(2σ^2))

solve(m)

println("μ = ", getvalue(μ))
println("mean(data) = ", mean(data))
println("σ^2 = ", getvalue(σ)^2)
println("var(data) = ", var(data))
println("MLE objective: ", getobjectivevalue(m))

```

---

<div class="post-metadata">

**Author:** ![evanfields](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/evanfields/32/1744_2.png) [@evanfields](https://discourse.julialang.org/u/evanfields)\
**Post date:** [February 10, 2017, 2:32am UTC](https://discourse.julialang.org/t/cant-run-jump-sample-code/2015/2 "2017-02-10T02:32:26Z")

</div>

I can run that code without issue on Windows 10, Julia 0.5, Jump 0.15.1, Ipopt 0.2.6. What happens if you try a different solver?

---

<div class="post-metadata">

**Author:** ![miles.lubin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miles.lubin/32/279_2.png) [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Post date:** [February 10, 2017, 2:36am UTC](https://discourse.julialang.org/t/cant-run-jump-sample-code/2015/3 "2017-02-10T02:36:16Z")

</div>

Ipopt is indeed broken on Windows: [https://github.com/JuliaOpt/Ipopt.jl/issues/77](https://github.com/JuliaOpt/Ipopt.jl/issues/77). @tkelman has thankfully gotten to the root of the issue, but the fix is not released at the moment. See that issue for further discussion.
