Closed robingirard closed 10 months ago
You're totally right! No MOSEK license should be required.
@FabianHofmann something maybe going wrong with the new context manager?
mmh, it works for me for all combinations:
are you on the latest master?
I installed with pip.
okay, could you then update the linopy package via pip? I just released version 0.3.2
It works now, thanks a lot.
great!
Hello @FabianHofmann
I am having a similar issue where I am not able to use the MOSEK solver although I do not get any error messages. I have installed the MOSEK package in the environment but it does not show up in the list of "available_solvers" in "linopy". I tried updating "linopy" as explained above but does not seem to change anything. Interestingly, I was able to use MOSEK a couple of days ago before the weekend but when I tried to use it again, it did not show up in the list of "available_solvers". I tried to work with gurobi to check if I was missing something but I was able to use gurobi.
Update:
with contextlib.suppress(ImportError):
import mosek
with contextlib.suppress(mosek.Error):
with mosek.Env() as m:
t = m.Task()
t.optimize()
m.checkinall()
available_solvers.append("mosek")
When I was debugging, the code stopped at "t.optimize()" and did not reach checkinall and append.
And it seems like it is a licensing error:
raise Error(rescode(_res_optimizetrm),_msg_optimizetrm)
mosek.Error: rescode.err_license_cannot_connect(1021): MOSEK cannot connect to the license server.
But from what I understand, I should be able to use MOSEK without license. Am I right or am I missing something?
Update - Solution:
I was able to figure it out.
It seemed like the code was not able to access the license file.
I manually added this during debugging to point out the location:
os.environ["MOSEKLM_LICENSE_FILE"] = "pathtolicensefile"
and from next time on it was able to automatically locate the license file.
Please look into this issue if necessary.
Dear Linopy community, I have installed version 0.3.1. I'm happy that MOSEK is now a possible solver, but when I import linopy on a computer without mosek I have the following error :
In [7]: import linopy Traceback (most recent call last): File "/home/rgirard/.virtualenvs/LEAP/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3548, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in
import linopy
File "/home/rgirard/.virtualenvs/LEAP/lib/python3.10/site-packages/linopy/init.py", line 12, in
from linopy import model, remote
File "/home/rgirard/.virtualenvs/LEAP/lib/python3.10/site-packages/linopy/model.py", line 21, in
from linopy import solvers
File "/home/rgirard/.virtualenvs/LEAP/lib/python3.10/site-packages/linopy/solvers.py", line 61, in
m.optimize()
File "/home/rgirard/.virtualenvs/LEAP/lib/python3.10/site-packages/mosek/init.py", line 10781, in optimize
return self.optimizetrm1(*args,**kwds)
File "/home/rgirard/.virtualenvs/LEAP/lib/python3.10/site-packages/mosek/init.py", line 10770, in optimizetrm1
raise Error(rescode(_res_optimizetrm),_msg_optimizetrm)
mosek.Error: rescode.err_missing_license_file(1008): License cannot be located. The default search path is ':/home/rgirard/mosek/mosek.lic:'.
It should be possible to import linopy without having a mosek license ! Am I missing something ?