Can't run JuMP sample code

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

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

ERROR: LoadError: LoadError: LoadError: invalid subtyping in definition of JuMPArray
 [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?



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))


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

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?

Ipopt is indeed broken on Windows: @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.