Seen in #551 CI tests, some of the changes in Pyomo v6.7.2 have caused an issue with using solver_io=python with gurobi. Easiest fix for now is to pin Pyomo to <v6.7.2.
Which operating systems have you used?
[X] macOS
[X] Windows
[X] Linux
Version
v0.7.0-dev4
Relevant log output
[gw1] linux -- Python 3.10.14 /home/runner/micromamba/envs/calliope-ubuntu-latest-310-25fc8eb0047f7544a957ed75a82f2329ea5bc9f33ae1c087115cbb13d6ef0f33/bin/python3.10
self = <tests.test_backend_pyomo.TestLogging object at 0x7fc2dd24cbb0>
caplog = <_pytest.logging.LogCaptureFixture object at 0x7fc2dae78910>
gurobi_model = <calliope.model.Model object at 0x7fc2dc0c1990>
def test_no_duplicate_log_message(self, caplog, gurobi_model):
caplog.set_level(logging.DEBUG)
> gurobi_model.solve()
tests/test_backend_pyomo.py:1689:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/calliope/model.py:470: in solve
results = self.backend._solve(warmstart=warmstart, **solver_config)
src/calliope/backend/pyomo_backend_model.py:322: in _solve
results = opt.solve(self._instance, tee=True, **solve_kwargs)
../../../micromamba/envs/calliope-ubuntu-latest-310-25fc8eb0047f7544a957ed75a82f2329ea5bc9f33ae1c087115cbb13d6ef0f33/lib/python3.10/site-packages/pyomo/solvers/plugins/solvers/direct_solver.py:75: in solve
self.available(exception_flag=True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyomo.solvers.plugins.solvers.gurobi_direct.GurobiDirect object at 0x7fc2da95a9e0>
exception_flag = True
def available(self, exception_flag=True):
"""Returns True if the solver is available.
:param exception_flag: If True, raise an exception instead of returning
False if the solver is unavailable (defaults to False)
:type exception_flag: bool
In general, ``available()`` does not need to be called by the user, as
the check is run automatically when solving a model. However it is useful
for a simple retry loop when using a shared Gurobi license::
with SolverFactory('gurobi', solver_io='python') as opt:
while not available(exception_flag=False):
time.sleep(1)
opt.solve(model)
"""
# First check gurobipy is imported
if not gurobipy_available:
if exception_flag:
gurobipy.log_import_warning(logger=__name__)
> raise ApplicationError(
"No Python bindings available for %s solver plugin" % (type(self),)
)
E pyomo.common.errors.ApplicationError: No Python bindings available for <class 'pyomo.solvers.plugins.solvers.gurobi_direct.GurobiDirect'> solver plugin
../../../micromamba/envs/calliope-ubuntu-latest-310-25fc8eb0047f7544a957ed75a82f2329ea5bc9f33ae1c087115cbb13d6ef0f33/lib/python3.10/site-packages/pyomo/solvers/plugins/solvers/gurobi_direct.py:215: ApplicationError
What happened?
Seen in #551 CI tests, some of the changes in Pyomo v6.7.2 have caused an issue with using
solver_io=python
with gurobi. Easiest fix for now is to pin Pyomo to <v6.7.2.Which operating systems have you used?
Version
v0.7.0-dev4
Relevant log output