-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mosek license file can no longer be found after #2326 #2445
Comments
For anyone looking for a workaround, the following works: import mosek
from cvxpy.tests.solver_test_helpers import StandardTestLPs
mosek.Env(
globalenv=True,
licensefile='/path/to/mosek.lic',
)
StandardTestLPs.test_lp_0(solver='MOSEK') |
@apmorton which mosek and cvxpy version are you using? |
mosek 10.1.31 |
In Mosek 10 with the global environment the path to the license file must be known before the first time Mosek is loaded. So an easier hack would be to first set the variable in os.environ and then "import mosek", or in any case set the environment before the first import of anything from mosek, cvxpy etc. that could load Mosek. I don't guarantee it works on Windows. The only true and correct solution of course is to never change the environment inside the process but set everything before calling the process. |
Thanks @aszekMosek for the explanation, and glad that @apmorton found a workaround. Does not appear to be directly related to a change in CVXPY, so I'm going ahead and close this issue for now. |
I'm not sure that is a fair assessment - this is the direct result of a change in cvxpy - #2326 Prior to then cvxpy wouldn't initialize mosek until the first usage, now it initializes it at import time. This is a noticeable behavior change and broke our usage of cvxpy. @aszekMosek is the workaround I posted above something supported by mosek? |
@apmorton sorry about that, misread the issue to be a change in mosek behavior! |
Both before and after #2326 CVXPY did not support any official mechanism to pass a license path to Mosek, so nothing changed in this respect. I would argue that both your solutions before and after #2326 are to some extent semi-supported hacks which one way or another try to bypass the one official mechanism applicable in this situation, which is to have MOSEKLM_LICENSE_FILE set in the initial environment of the process. Yes, the workaround works because it is ultimately equivalent to calling the API method If you would like to then please contact Mosek support and we can think what else can be done about that. |
We have been relying on the ability to set The requirement to know this path and set an environment variable prior to process creation in all possible scenarios where mosek will be used is very tedious. We will be reaching out to support on this matter since having the ability to set this at runtime is important to our business. |
We have some idea for what we could change so that you get an official, supported solution, but that will be in Mosek version 10.2, ie. the current one. We can discuss it in support. Just to summarize the other current options for how to modify the license path in the global Mosek environment:
The proposed solution we have in mind goes towards cleaning up and legalizing something along the lines of 1. Until you can use that then the solution in 1. is probably best. |
Describe the bug
Setting
MOSEKLM_LICENSE_FILE
in the current processes environment prior to using cvxpy no longer works.To Reproduce
Expected behavior
I expect the code above to continue working.
Output
This now raises:
See: #2326
The text was updated successfully, but these errors were encountered: