Problem with Mosek

Dear All,

I am trying to solve an SDP using Convex.jl and Mosek. My Mosek version is 9.1.11, and Convex.jl version is 0.12.6. My Julia version is 1.3. I have installed Mosek with an academic license, and it seems to be working just fine otherwise.

However, whenever I run

using Mosek

I get:

[ Info: Precompiling Mosek [6405355b-0ac2-5fba-af84-adbd65488c0e]
ERROR: LoadError: Mosek not properly installed. Please run Pkg.build("Mosek")
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] top-level scope at C:\Users\user\.julia\packages\Mosek\r4MUf\src\Mosek.jl:10
 [3] include at .\boot.jl:328 [inlined]
 [4] include_relative(::Module, ::String) at .\loading.jl:1105
 [5] include(::Module, ::String) at .\Base.jl:31
 [6] top-level scope at none:2
 [7] eval at .\boot.jl:330 [inlined]
 [8] eval(::Expr) at .\client.jl:425
 [9] top-level scope at .\none:3
in expression starting at C:\Users\user\.julia\packages\Mosek\r4MUf\src\Mosek.jl:7
ERROR: Failed to precompile Mosek [6405355b-0ac2-5fba-af84-adbd65488c0e] to C:\Users\user\.julia\compiled\v1.3\Mosek\vS2ln_ENdWE.ji.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1283
 [3] _require(::Base.PkgId) at .\loading.jl:1024
 [4] require(::Base.PkgId) at .\loading.jl:922
 [5] require(::Module, ::Symbol) at .\loading.jl:917

And then if I try

Pkg.build("Mosek")

I get:

  Building Mosek → `C:\Users\user\.julia\packages\Mosek\r4MUf\deps\build.log`
┌ Error: Error building `Mosek`:
│ ERROR: LoadError: Failed to get MOSEK download host
│ Stacktrace:
│  [1] error(::String) at .\error.jl:33
│  [2] top-level scope at C:\Users\user\.julia\packages\Mosek\r4MUf\deps\build.jl:150
│  [3] include at .\boot.jl:328 [inlined]
│  [4] include_relative(::Module, ::String) at .\loading.jl:1105
│  [5] include(::Module, ::String) at .\Base.jl:31
│  [6] include(::String) at .\client.jl:424
│  [7] top-level scope at none:5
│ in expression starting at C:\Users\user\.julia\packages\Mosek\r4MUf\deps\build.jl:105
└ @ Pkg.Operations D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.3\Pkg\src\backwards_compatible_isolation.jl:649

I will appreciate any suggestions regarding how to resolve the issue.

Hello,

For me,

using Pkg
Pkg.activate(mktempdir()) # activate a temp environment
Pkg.add("Mosek")
using Mosek

runs OK and doesn’t error. The second error that you got, ERROR: LoadError: Failed to get MOSEK download host sounds like maybe an internet problem? (edit: it looks like that error is coming from this line of the code, so it seems like a problem with the download: https://github.com/JuliaOpt/Mosek.jl/blob/5cff9fbf0a12cb82d109eb2d283c017b5e78c99d/deps/build.jl#L150).

When I build Mosek.jl, the log shows

[ Info: Get latest MOSEK version (https://d2i6rjz61faulo.cloudfront.net/stable/9.1/version)
[ Info: Latest MOSEK version = 9.1.11, currently installed = 9.1.9
[ Info: Download MOSEK distro (https://d2i6rjz61faulo.cloudfront.net/stable/9.1.11/mosektoolsosx64x86.tar.bz2)
[ Info: Unpack MOSEK distro (/Users/eh540/.julia/packages/Mosek/r4MUf/deps/downloads/mosektoolsosx64x86.tar.bz2 -> /Users/eh540/.julia/packages/Mosek/r4MUf/deps/src)
[ Info: MOSEK installation complete.
[ Info: mskbindir = /Users/eh540/.julia/packages/Mosek/r4MUf/deps/src/mosek/9.1/tools/platform/osx64x86/bin

in case that’s any help.

Something else to note though is that the current release branch of Mosek.jl and the current release branch of Convex.jl don’t work together, unfortunately, because the current release of Convex uses the older MathProgBase which Mosek.jl doesn’t support anymore. So one either needs to either

  • use an older version of Mosek, by entering ] add Mosek#b0.9 in the Julia REPL (] activates package mode) (and restart your Julia session if Mosek is already loaded),
  • or (what I’d recommend) use the development branch of Convex.jl via ]add Convex#master, which uses MathOptInterface. The main difference is one does solve!(p, Mosek.Optimizer()) instead of solve!(p, MosekSolver()). I hope to get a new release of Convex.jl out relatively soon which has this update.

Thanks a lot for your quick response, I was able to solve the SDP using SCS. That being said, running the commands you suggested did not help me, I am getting a new set of errors now. When I run

solve!(problem, Mosek.Optimizer())

I get:


MethodError: no method matching solve!(::Problem, ::MosekModel)
Closest candidates are:
  solve!(::Problem; warmstart, check_vexity, verbose) at C:\Users\user\.julia\packages\Convex\Aro4K\src\solution.jl:21
  solve!(::Problem, !Matched::MathProgBase.SolverInterface.AbstractMathProgSolver; kwargs...) at C:\Users\user\.julia\packages\Convex\Aro4K\src\solution.jl:12
in top-level scope at est.jl:16

I guess for now I will just use SCS for my problem rather than Mosek. Thank you again.

Ah, glad SCS worked for you. To be clear, solve!(problem, Mosek.Optimizer()) only works currently on the master branch of Convex.jl, so you would need to install that and start a new session in order for that to work. (I think also one needs to use the package MosekTools.jl instead of Mosek.jl).

Thanks, will try it!

1 Like