Issue installing Mosek on JuMP

228 views
Skip to first unread message

Abdulrahman Aldeek

unread,
Sep 13, 2021, 1:14:48 AM9/13/21
to mosek
Hello

I'm facing an issue while trying to use Mosek in Julia environment. I have to emphsize that Mosek is working on Matlab and it is licensed (Academic). I'm getting the following error when trying to build Mosek as follows

julia> Pkg.build("Mosek")
    Building Mosek → `C:\Users\Abd-PC\.julia\scratchspaces\44cfe95a-1eb2-52ea-b672-e2afdf69b78f\883be630ab4a25991037c2a2079d7170a5a8908e\build.log`
ERROR: Error building `Mosek`:
[ Info: Download command: `powershell -file 'C:\Users\Abd-PC\.julia\packages\Mosek\6LuE3\deps\winget.ps1' https://www.mosek.com/downloads/default_dns.txt 'C:\Users\Abd-PC\.julia\packages\Mosek\6LuE3\deps\downloads\downloadhostname'`
┌ Error: File C:\Users\Abd-PC\.julia\packages\Mosek\6LuE3\deps\winget.ps1 cannot be loaded because running scripts is disabled on
│ this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.        
│     + CategoryInfo          : SecurityError: (:) [], ParentContainsErrorRecordException
│     + FullyQualifiedErrorId : UnauthorizedAccess
└ @ Main C:\Users\Abd-PC\.julia\packages\Mosek\6LuE3\deps\build.jl:203
ERROR: LoadError: Failed to get MOSEK download host
Stacktrace:
 [1] error(s::String)
   @ Base .\error.jl:33
 [2] top-level scope
   @ C:\Users\Abd-PC\.julia\packages\Mosek\6LuE3\deps\build.jl:204
 [3] include(fname::String)
   @ Base.MainInclude .\client.jl:444
 [4] top-level scope
   @ none:5
in expression starting at C:\Users\Abd-PC\.julia\packages\Mosek\6LuE3\deps\build.jl:144
Stacktrace:
  [1] pkgerror(msg::String)
    @ Pkg.Types C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Types.jl:55
  [2] (::Pkg.Operations.var"#82#87"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec})()
    @ Pkg.Operations C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Operations.jl:1048
  [3] withenv(::Pkg.Operations.var"#82#87"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec}, ::Pair{String, String}, ::Vararg{Pair{String, B} where B, N} where N)
    @ Base .\env.jl:161
  [4] (::Pkg.Operations.var"#109#113"{String, Pkg.Operations.var"#82#87"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec}, Pkg.Types.PackageSpec})()
    @ Pkg.Operations C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Operations.jl:1546
  [5] with_temp_env(fn::Pkg.Operations.var"#109#113"{String, Pkg.Operations.var"#82#87"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec}, Pkg.Types.PackageSpec}, temp_env::String)
    @ Pkg.Operations C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Operations.jl:1448
  [6] (::Pkg.Operations.var"#108#112"{Pkg.Operations.var"#82#87"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec}, Pkg.Types.Context, Pkg.Types.PackageSpec, String, Pkg.Types.Project, String})(tmp::String)
    @ Pkg.Operations C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Operations.jl:1521
  [7] mktempdir(fn::Pkg.Operations.var"#108#112"{Pkg.Operations.var"#82#87"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec}, Pkg.Types.Context, Pkg.Types.PackageSpec, String, Pkg.Types.Project, String}, parent::String; prefix::String)    
    @ Base.Filesystem .\file.jl:729
  [8] mktempdir(fn::Function, parent::String) (repeats 2 times)
    @ Base.Filesystem .\file.jl:727
  [9] sandbox(fn::Function, ctx::Pkg.Types.Context, target::Pkg.Types.PackageSpec, target_path::String, sandbox_path::String, sandbox_project_override::Pkg.Types.Project)
    @ Pkg.Operations C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Operations.jl:1487
 [10] build_versions(ctx::Pkg.Types.Context, uuids::Vector{Base.UUID}; verbose::Bool)
    @ Pkg.Operations C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Operations.jl:1029
 [11] build(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}, verbose::Bool)
    @ Pkg.Operations C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Operations.jl:910
 [12] build(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; verbose::Bool, kwargs::Base.Iterators.Pairs{Symbol, Base.TTY, Tuple{Symbol}, NamedTuple{(:io,), Tuple{Base.TTY}}})
    @ Pkg.API C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:900
 [13] build(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Pkg.API C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:80
 [14] build(pkgs::Vector{Pkg.Types.PackageSpec})
    @ Pkg.API C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:78
 [15] #build#71
    @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:76 [inlined]
 [16] build
    @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:76 [inlined]
 [17] #build#70
    @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:75 [inlined]
 [18] build(pkg::String)
    @ Pkg.API C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:75
 [19] top-level scope
    @ none:1

I would appreciate your help in this regard.

Erling D. Andersen

unread,
Sep 13, 2021, 1:44:43 AM9/13/21
to mosek
It seems PowerShell is blocked from doing something it has to do:

┌ Error: File C:\Users\Abd-PC\.julia\packages\Mosek\6LuE3\deps\winget.ps1 cannot be loaded because running scripts is disabled on
│ this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.        
│     + CategoryInfo          : SecurityError: (:) [], ParentContainsErrorRecordException
│     + FullyQualifiedErrorId : UnauthorizedAccess
└ @ Main C:\Users\Abd-PC\.julia\packages\Mosek\6LuE3\deps\build.jl:203

Ulf Worsoe

unread,
Sep 13, 2021, 5:20:50 AM9/13/21
to mosek
On windows we use Powershell for downloading the MOSEK distro. Recently we have seen that powershell script may be disabled, which causes the error you have. Unfortunately we don't have another way to download the distro on windows, so you have to either install the distro by hand or change the script execution permissions.

Erling D. Andersen

unread,
Sep 13, 2021, 8:03:28 AM9/13/21
to mosek
Maybe doing the installation as an administrator will work.

Abdulrahman Aldeek

unread,
Sep 13, 2021, 9:38:01 AM9/13/21
to mosek
I have changed the execution policy to "unrestricted". It seems that Mosek was been able to download. However, When I tried to use it to solve an SDP problem, I got the following error

julia> using MosekTools

julia> solver3=Mosek.Optimizer;

julia> test=run_opf("pglib_opf_case3_lmbd.m",SDPWRMPowerModel,solver3)
[info | PowerModels]: removing 3 cost terms from generator 3: Float64[]
Problem
  Name                   :
  Objective sense        : min
  Type                   : CONIC (conic optimization problem)
  Constraints            : 84
  Cones                  : 8
  Scalar variables       : 59
  Matrix variables       : 1
  Integer variables      : 0

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 4
Eliminator terminated.
Eliminator - tries                  : 1                 time                   : 0.00
Lin. dep.  - tries                  : 1                 time                   : 0.00
Lin. dep.  - number                 : 0
Presolve terminated. Time: 0.00
Problem
  Name                   :
  Objective sense        : min
  Type                   : CONIC (conic optimization problem)
  Constraints            : 84
  Cones                  : 8
  Scalar variables       : 59
  Matrix variables       : 1
  Integer variables      : 0

Optimizer  - threads                : 4
Optimizer  - solved problem         : the primal
Optimizer  - Constraints            : 45
Optimizer  - Cones                  : 8
Optimizer  - Scalar variables       : 42                conic                  : 24
Optimizer  - Semi-definite variables: 1                 scalarized             : 21
Factor     - setup time             : 0.00              dense det. time        : 0.00
Factor     - ML order time          : 0.00              GP order time          : 0.00
Factor     - nonzeros before factor : 522               after factor           : 666
Factor     - dense dim.             : 0                 flops                  : 1.53e+04
ITE PFEAS    DFEAS    GFEAS    PRSTATUS   POBJ              DOBJ              MU       TIME
0   4.0e+02  1.1e+03  1.7e+03  0.00e+00   1.378858223e+03   -3.617071068e+02  1.0e+00  0.02
1   1.4e+02  3.8e+02  1.0e+03  -9.95e-01  4.074955389e+02   -1.320755977e+03  3.4e-01  0.02
2   3.7e+01  1.0e+02  5.1e+02  -9.74e-01  1.069700097e+03   -5.801766013e+02  9.4e-02  0.02
3   6.8e+00  1.9e+01  1.8e+02  -8.86e-01  7.919269178e+02   -4.689038453e+02  1.7e-02  0.02
4   3.4e+00  9.4e+00  9.2e+01  -3.47e-01  1.237092452e+03   3.215996112e+02   8.5e-03  0.02
5   2.0e+00  5.4e+00  5.5e+01  -1.09e-01  1.857274541e+03   1.110309443e+03   4.9e-03  0.02
6   7.2e-01  2.0e+00  1.6e+01  1.38e-01   3.280923763e+03   2.905143334e+03   1.8e-03  0.03  
7   3.5e-01  9.7e-01  7.3e+00  4.14e-01   4.060441522e+03   3.816940404e+03   8.8e-04  0.03
8   1.3e-01  3.5e-01  1.7e+00  7.26e-01   5.018656391e+03   4.922332213e+03   3.2e-04  0.03
9   3.5e-02  9.6e-02  2.9e-01  7.60e-01   5.531093359e+03   5.501868259e+03   8.7e-05  0.03
10  7.2e-03  2.0e-02  2.8e-02  9.65e-01   5.732978742e+03   5.726824413e+03   1.8e-05  0.03
11  9.1e-04  2.5e-03  1.3e-03  9.86e-01   5.783062371e+03   5.782282977e+03   2.3e-06  0.03
12  1.2e-04  3.2e-04  5.9e-05  9.98e-01   5.789584491e+03   5.789484432e+03   2.9e-07  0.03
13  1.6e-05  4.5e-05  3.0e-06  1.00e+00   5.790410450e+03   5.790396697e+03   4.1e-08  0.03
14  1.3e-06  3.7e-06  7.1e-08  1.00e+00   5.790531698e+03   5.790530572e+03   3.3e-09  0.03
15  1.3e-07  2.5e-06  2.2e-09  1.00e+00   5.790542029e+03   5.790541918e+03   3.2e-10  0.03
16  1.5e-08  3.2e-07  8.1e-11  1.00e+00   5.790542574e+03   5.790542561e+03   3.6e-11  0.03
Optimizer terminated. Time: 0.05

MOSEK error 3915: There is no barx available for the solution type 2.
ERROR: Mosek.MosekError(3915, "There is no barx available for the solution type 2.")
Stacktrace:
  [1] getbarxj(task_::Mosek.Task, whichsol_::Mosek.Soltype, j_::Int32)
    @ Mosek C:\Users\Abd-PC\.julia\packages\Mosek\6LuE3\src\msk_functions.jl:2087
  [2] getbarxj
    @ C:\Users\Abd-PC\.julia\packages\Mosek\6LuE3\src\msk_functions.jl:2077 [inlined]
  [3] matrix_solution(m::MosekModel, sol::Mosek.Soltype)
    @ MosekTools C:\Users\Abd-PC\.julia\packages\MosekTools\sppJY\src\MosekTools.jl:268
  [4] optimize!(m::MosekModel)
    @ MosekTools C:\Users\Abd-PC\.julia\packages\MosekTools\sppJY\src\MosekTools.jl:275
  [5] optimize!(b::MathOptInterface.Bridges.LazyBridgeOptimizer{MosekModel})
    @ MathOptInterface.Bridges C:\Users\Abd-PC\.julia\packages\MathOptInterface\YDdD3\src\Bridges\bridge_optimizer.jl:319  
  [6] optimize!(m::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ModelFunctionConstraints{Float64}}}})
    @ MathOptInterface.Utilities C:\Users\Abd-PC\.julia\packages\MathOptInterface\YDdD3\src\Utilities\cachingoptimizer.jl:252
  [7] optimize!(model::JuMP.Model, optimizer_factory::Nothing; bridge_constraints::Bool, ignore_optimize_hook::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ JuMP C:\Users\Abd-PC\.julia\packages\JuMP\klrjG\src\optimizer_interface.jl:185
  [8] optimize! (repeats 2 times)
    @ C:\Users\Abd-PC\.julia\packages\JuMP\klrjG\src\optimizer_interface.jl:157 [inlined]
  [9] macro expansion
    @ .\timing.jl:368 [inlined]
 [10] optimize_model!(aim::SDPWRMPowerModel; relax_integrality::Bool, optimizer::Function, solution_processors::Vector{Any})
    @ InfrastructureModels C:\Users\Abd-PC\.julia\packages\InfrastructureModels\k2fNE\src\core\base.jl:397
 [11] run_model(data::Dict{String, Any}, model_type::Type, optimizer::typeof(Mosek.Optimizer), build_method::typeof(build_opf); ref_extensions::Vector{Any}, solution_processors::Vector{Any}, relax_integrality::Bool, multinetwork::Bool, multiconductor::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ PowerModels C:\Users\Abd-PC\.julia\packages\PowerModels\vPrY3\src\core\base.jl:52
 [12] run_model(data::Dict{String, Any}, model_type::Type, optimizer::Function, build_method::Function)
    @ PowerModels C:\Users\Abd-PC\.julia\packages\PowerModels\vPrY3\src\core\base.jl:35
 [13] run_model(file::String, model_type::Type, optimizer::Function, build_method::Function; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ PowerModels C:\Users\Abd-PC\.julia\packages\PowerModels\vPrY3\src\core\base.jl:27
 [14] run_model
    @ C:\Users\Abd-PC\.julia\packages\PowerModels\vPrY3\src\core\base.jl:26 [inlined]
 [15] #run_opf#1082
    @ C:\Users\Abd-PC\.julia\packages\PowerModels\vPrY3\src\prob\opf.jl:13 [inlined]
 [16] run_opf(file::String, model_type::Type, optimizer::Function)
    @ PowerModels C:\Users\Abd-PC\.julia\packages\PowerModels\vPrY3\src\prob\opf.jl:13
 [17] top-level scope
    @ none:1

Erling D. Andersen

unread,
Sep 13, 2021, 9:49:38 AM9/13/21
to mosek
To me it seems there is a bug in the code that calls Mosek since it ask for integer solution and not the interior-point solution.
I.e. the bug is outside Mosek.

Abdulrahman Aldeek

unread,
Sep 13, 2021, 10:04:31 AM9/13/21
to mosek
Is there any way to go around it? I can see that Mosek has found the solution but set, we get this error.

Erling D. Andersen

unread,
Sep 13, 2021, 10:11:54 AM9/13/21
to mosek
The tool 

MosekTool.jl

is buggy and should be patched. We have notified the makers of MosekTools.jl but we can not say when they fix it.

Erling D. Andersen

unread,
Sep 13, 2021, 10:12:40 AM9/13/21
to mosek
Btw it is MOsekTools.jl

Michal Adamaszek

unread,
Sep 13, 2021, 10:14:53 AM9/13/21
to mosek

I think "fixing" this issue introduced the problem


One solution could be that you do not set any starting values - they are useless for the semidefinite solver anyway.

Another thing that could possibly solve it is to set the parameter MSK_IPAR_REMOVE_UNUSED_SOLUTIONS.

But that's just my guess form looking at the MosekTools code

Michal Adamaszek

unread,
Sep 13, 2021, 10:18:12 AM9/13/21
to mosek

Ulf Worsoe

unread,
Sep 13, 2021, 10:57:29 AM9/13/21
to mosek
MosekTools is maintained by the JuMP community, so we don't have direct write access, but it should be simple enough to fix if you modify MosekTools.jl. See this issue https://github.com/jump-dev/MosekTools.jl/issues/72
Reply all
Reply to author
Forward
0 new messages