title: How to run MOSEK solver in CVXOPT
body: <p>I have written a small code to do a simple min variance optimisation using CVXOPT, you can see the whole code below</p>
  
  <p>By using solvers.qp(P, q, G, h, A, b) in CVXOPT the code runs fine and it find a solution</p>
  
  <pre><code>solvers.qp(P, q, G, h, A, b)
  </code></pre>
  
  <p>I wanted to try a different solver too, hence I used MOSEK by solving the same problem with the following parameters</p>
  
  <pre><code>solvers.qp(P, q, G, h, A, b, solver='mosek') 
  </code></pre>
  
  <p>When using solver='mosek' the code cannot run and it is giving me the following error</p>
  
  <p>MOSEK error 1295: The quadratic coefficient matrix in the objective is not positive semidefinite as expected for a minimization problem</p>
  
  <p>Can anyone explain why I got this error (have I coded something in the wrong way?) and if there is a workaround to solve the issue I am facing with MOSEK  </p>
  
  <pre><code>import numpy as np
  import cvxopt as opt
  import mosek
  from cvxopt import matrix, solvers
  
  def optimize_portfolio(n, Var_Cov):
          P = opt.matrix (Var_Cov)
          q = opt.matrix(np.matrix(np.zeros((n, 1))))
          G = opt.matrix(np.array(-np.identity(n)))
          h = opt.matrix(np.zeros((n,1)))             
          A = opt.matrix(1.0, (1,n))
          b = opt.matrix(1.0)
  
          # Finding a solution
  
          sol = solvers.qp(P, q, G, h, A, b, solver='mosek')
          return sol
  
  ### Parameters setup
  
  Var_Cov = np.loadtxt('C:\VAR_COV.txt')
  n = len (Var_Cov)
  
  ### solve
  solution = optimize_portfolio(n, Var_Cov)
  
  # Save Results
  Port_Opt = np.matrix(solution['x'])
  </code></pre>