Skip to main content

Model() not included in gurobipy

Ongoing

Comments

5 comments

  • Official comment
    Simranjit Kaur
    Gurobi Staff Gurobi Staff
    This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?.
  • Sonja Mars
    Gurobi Staff Gurobi Staff

    Hi Lukas,

    Can you please post a small code example that reproduces the issue?

    Thanks,

      Sonja

    -1
  • Lukas Winkel
    Gurobi-versary
    Conversationalist
    First Question

    Hi Sonja,

    sure, the code:

     

    from gurobipy import *

    m = Model("qp")

     

    throws:

     

    NameError: name 'Model' is not defined



    When using:

     

    from gurobipy import *

    print(dir(gurobipy))

     

    to print the directory, it prints:

     

    ['Column', 'Constr', 'Env', 'GenConstr', 'LinExpr', 'QConstr', 'QuadExpr', 'SOS', 'TempConstr', 'Var', '__builtins__', '__bytestostring', '__doc__', '__isscalar', '__loader__', '__name__', '__package__', '__pyx_capi__', '__simpleexpr', '__spec__', '__stringtobytes', 'dis', 'gc', 'itertools', 'math', 'numbers', 'os', 're', 'types']

     

    Clearly, 'Model' is missing in the directory. But when I'm running the exact same code in Jupyter or the Shell, it is working correctly and printing the contents of the directory correctly.
    I'm not sure if it is a problem concerning Spyder or a problem concerning the installation of Gurobi.

    Kind regards,
    Lukas

     

    0
  • guy farmer
    Gurobi-versary
    First Comment

    Can someone please give an update to this thread? Myself and my team are also having the same issue

    0
  • Gwyneth Butera
    Gurobi Staff Gurobi Staff

    Hi Guy - 

    Can you please give us your setup details so we can assist?

    For example;
    - OS version
    - Anaconda version number
    - Exact Gurobi version number

    Thanks.

    0

Post is closed for comments.