Linking CVXPY with MOSEK

573 views
Skip to first unread message

David Rey

unread,
Jan 30, 2017, 2:56:37 PM1/30/17
to cvxpy
Hi, I am having trouble linking CVXPY with MOSEK. I am using a Windows 10 machine and I installed CVXPY using Python(x,y). I got an academic licence from MOSEK and installed the Python interface.

I can successfully do "import mosek", i.e.:

import cvxpy as cvx
print cvx
import mosek
print mosek

gives: 
<module 'cvxpy' from 'C:\Python27\lib\site-packages\cvxpy\__init__.pyc'>
<module 'mosek' from 'C:\Python27\lib\site-packages\mosek\__init__.pyc'>

but if I print installed solvers MOSEK is not there:

print cvx.installed_solvers()
['CVXOPT', 'ECOS_BB', 'GLPK_MI', 'SCS', 'ECOS', 'GLPK']

and whenever I try to use it I get an unknown solver error: 

<ipython-input-15-0e1d9d2df7af> in solve_PX(ftemp, data)
     28     prob = cvx.Problem(obj, constraints)
     29 
---> 30     result = prob.solve(solver='MOSEK')
     31 
     32     msg_PX = prob.status

C:\Python27\lib\site-packages\cvxpy\problems\problem.pyc in solve(self, *args, **kwargs)
    154             return func(self, *args, **kwargs)
    155         else:
--> 156             return self._solve(*args, **kwargs)
    157 
    158     @classmethod

C:\Python27\lib\site-packages\cvxpy\problems\problem.pyc in _solve(self, solver, ignore_dcp, warm_start, verbose, **kwargs)
    233             solver.validate_solver(constraints)
    234         else:
--> 235             raise SolverError("Unknown solver.")
    236 
    237         sym_data = solver.get_sym_data(objective, constraints,

SolverError: Unknown solver.

I also tested running a MOSEK Python example and it works.

Could you help me link CVXPY with MOSEK?

Thanks, 
-David

Steven Diamond

unread,
Jan 31, 2017, 1:05:24 PM1/31/17
to cvxpy
I don't think the Python(x,y) cvxpy distribution supports MOSEK. It's quite an old version of cvxpy. Try installing the Anaconda cvxpy distribution.

David Rey

unread,
Jan 31, 2017, 4:07:31 PM1/31/17
to cvxpy
Hi Steven, 

Unfortunately, the Anaconda cvxpy distribution is not well support on Windows: there is a bug when linking BLAS and LAPACK librairies (this why I switched to Python(x,y)).

However, I managed to resolve the issue by updating cvxpy to the latest myself (indeed Python(x,y) was using an older version) and it works now. 

Thanks
Reply all
Reply to author
Forward
0 new messages