I want to use Gurobi with python-mip. I run the following:
from mip import Model, GUROBI
Model("test_problem", solver_name=GUROBI)
I receive the following error: InterfacingError('Gurobi environment could not be loaded, check your license.')
.
I followed Python-MIP's instructions to enable the use of Gurobi. I run gurobi.sh
from my terminal and get the following output:
Gurobi Interactive Shell (mac64), Version 10.0.2
Copyright (c) 2023, Gurobi Optimization, LLC
Type "help()" for help
gurobi>
According to Gurobi's documentation, this means Gurobi has installed correctly (I left off my license details, but yes I have an active license). I call echo $GUROBI_HOME
just to make sure I have the path required in Python-MIP's documentation set, and I get the output /Library/gurobi1002/macos_universal2
, so I assume I do.
With all of this in mind, I was expecting my two lines of Python above to run without issue and instantiate a Model object.
So I spoke with Gurobi support and it appears I just misunderstood how their licenses work. I had a single use license, which I understood to be applicable for solving gurobi.Model
instances in series. If what I learned is correct, it turns out a single use license is a bit more restrictive, where multiple models are not allowed to be in memory at the same time, even if they're never solved in parallel. I upgraded to an unlimited use license to resolve this issue.