简体   繁体   中英

How to install mosek for cvxpy?

Previously I used command conda install -c mosek mosek to install mosek(my IDE is VS Code and use anaconda environment). After I installed it, I ran a program for a convex optimization problem, and one line of code was(because I want to choose mosek as solver):

prob.solve(solver=cp.MOSEK)

then an error pops up:

cvxpy.error.SolverError: The solver MOSEK is not installed.

BUT I have MOSEK installed. I used the following piece of code to detect:

import cvxpy as cp

print(cp.installed_solvers())

the result is:

['ECOS', 'ECOS_BB', 'OSQP', 'SCIPY', 'SCS']

Why does this happen?

I used the conda list command to check if I have mosek installed:

相关图片

But I did install it!

How can I solve it?


Besides, every time I run the program it pops up this error:

Encountered unexpected exception importing solver MOSEK:
ImportError('DLL load failed while importing _msk: 找不到指定的模块。')

Have you tested that your conda installed Mosek can be used outside Cvxpy ie directly from Python.

Make sure your needed module is installed in the current selected environment. Open an new integrated Terminal and run conda list mosek , check if its location is the one shown in status bar:

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM