Model() not included in gurobipy
OngoingHey there,
I'm using Gurobi8.1 in Anaconda (Spyder3.7 IPE) under an Academic License.
When I'm trying to use the class Model(), the compiler throws a NameError and tells me, that Model is not defined.
Printing dir(gurobipy) shows everything but Model:
['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'].
How is that possible? Any suggestions on how to fix that?
Thanks in advance!
-
Hi Lukas,
Can you please post a small code example that reproduces the issue?
Thanks,
Sonja
-1 -
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,
Lukas0 -
Can someone please give an update to this thread? Myself and my team are also having the same issue
0 -
Hi Guy -
Can you please give us your setup details so we can assist?
For example;
- OS version
- Anaconda version number
- Exact Gurobi version numberThanks.
0
Please sign in to leave a comment.
Comments
4 comments