Messages being printed to standard output when library is loaded
AnsweredCurrently,
Using license file /Users/[username]/gurobi.lic
Academic license - for non-commercial use only
is printed to standard output every time I run a Python script that uses Gurobi (e.g. when executing a batch of such scripts sequentially). Is it possible to disable one or both of these messages through some environment flag?
-
Official comment
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?. -
Hi Carlos,
You could set the OutputFlag parameter before the Gurobi environment is even started. E.g.:
import gurobipy as gp
with gp.Env(empty=True) as env:
env.setParam('OutputFlag', 0)
env.start()
with gp.Model(env=env) as m:
# Build model m hereDoes this work for you?
Eli
0 -
Eli Towle Thanks, that seems to work. Is there a way to change the default for OutputFlag globally (e.g. through some system-wide environment variable or setting)?
0 -
Hi Carlos,
There's no way to change OutputFlag on a system level.
An alternative approach (that may better fit your usage) is to create a \( \texttt{gurobi.env} \) file (see here) in the current working directory of your scripts, and add to that file the single line
OutputFlag 0
Gurobi will automatically look for a \( \texttt{gurobi.env} \) file to use in the current working directory. If it finds one, it applies the listed parameters to new Gurobi environments. So, if you have such a \( \texttt{gurobi.env} \) file in the same directory as your scripts, your scripts don't need to create a special environment:
import gurobipy as gp
with gp.Model() as m:
# Build model m hereThanks,
Eli
0
Post is closed for comments.
Comments
4 comments