Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pyomo v6.7.2 regression: Gurobi Python interface not found #597

Open
3 tasks done
brynpickering opened this issue May 14, 2024 · 0 comments
Open
3 tasks done

Pyomo v6.7.2 regression: Gurobi Python interface not found #597

brynpickering opened this issue May 14, 2024 · 0 comments
Labels
bug has-workaround The issue describes a valid workaround until the primary issue is solved

Comments

@brynpickering
Copy link
Member

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?

  • macOS
  • Windows
  • 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
@brynpickering brynpickering added bug has-workaround The issue describes a valid workaround until the primary issue is solved labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug has-workaround The issue describes a valid workaround until the primary issue is solved
Projects
None yet
Development

No branches or pull requests

1 participant