'Using Mosek with Drake on Deepnote

ValueError: "MosekSolver cannot Solve because MosekSolver::available() is false, i.e., MosekSolver has not been compiled as part of this binary. Refer to the MosekSolver class overview documentation for how to compile it."

Hi, I got the above error when trying to use the Mosek solver in Drake. It is not clear to me how to enable Mosek in Deepnote with Drake. Do I need to include something in the Dockerfile or the init file? Any tips would be appreciated.

Links I looked at: https://drake.mit.edu/pydrake/pydrake.solvers.mosek.html https://drake.mit.edu/bazel.html#mosek



Solution 1:[1]

Mosek+Drake does work on Deepnote. The workflow is like this:

  1. Obtain a Mosek license file (from the Mosek website), and upload it to Deepnote.
  2. Set an environment variable to tell Drake where to find the license file. For instance, you can add the following at the top of your notebook:
import os
os["MOSEKLM_LICENSE_FILE"] = "mosek.lic"

Now MosekSolver.available() should be True, and Mosek will even be chosen as the default preferred solver for if you simply call Solve(prog).

Note: Please be very careful not to share the Deepnote notebook with your mosek.lic uploaded.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Russ Tedrake