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: 找不到指定的模块。')
CodePudding user response:
Have you tested that your conda installed Mosek can be used outside Cvxpy i.e. directly from Python.
CodePudding user response:
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:

