Giter Club home page Giter Club logo

Comments (7)

fneum avatar fneum commented on July 18, 2024

You're totally right! No MOSEK license should be required.

@FabianHofmann something maybe going wrong with the new context manager?

linopy/linopy/solvers.py

Lines 57 to 66 in a97febe

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")

from linopy.

FabianHofmann avatar FabianHofmann commented on July 18, 2024

mmh, it works for me for all combinations:

  • package uninstalled, no license
  • package installed, no license
  • package installed, with license

are you on the latest master?

from linopy.

robingirard avatar robingirard commented on July 18, 2024

I installed with pip.

from linopy.

FabianHofmann avatar FabianHofmann commented on July 18, 2024

okay, could you then update the linopy package via pip? I just released version 0.3.2

from linopy.

robingirard avatar robingirard commented on July 18, 2024

It works now, thanks a lot.

from linopy.

FabianHofmann avatar FabianHofmann commented on July 18, 2024

great!

from linopy.

asre244 avatar asre244 commented on July 18, 2024

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.

available_solvers
installed packages

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.

from linopy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.