-1

I am reciving this error and I do not know what to do?

WARNING: Failed to create solver with name 'gurobipy': Failed to set
    executable for solver asl. File with name=gurobipy either does not exist
    or it is not executable. To skip this validation, call set_executable with
    validate=False.
Traceback (most recent call last):
  File "C:\Users\Admin\anaconda3\lib\site-packages\pyomo\opt\base\solvers.py", line 165, in __call__
    opt = self._cls[_implicit_solvers[mode]](**kwds)
  File "C:\Users\Admin\anaconda3\lib\site-packages\pyomo\solvers\plugins\solvers\ASL.py", line 43, in __init__
    SystemCallSolver.__init__(self, **kwds)
  File "C:\Users\Admin\anaconda3\lib\site-packages\pyomo\opt\solver\shellcmd.py", line 55, in __init__
    self.set_executable(name=executable, validate=validate)
  File "C:\Users\Admin\anaconda3\lib\site-packages\pyomo\opt\solver\shellcmd.py", line 103, in set_executable
    raise ValueError(
ValueError: Failed to set executable for solver asl. File with name=gurobipy either does not exist or it is not executable. To skip this validation, call set_executable with validate=False.
# ==========================================================
# = Solver Results                                         =
# ==========================================================
# ----------------------------------------------------------
#   Problem Information
# ----------------------------------------------------------
Problem: 
- Name: unknown
  Lower bound: 470596988.01111543
  Upper bound: 470596988.0111167
  Number of objectives: 1
  Number of constraints: 36011
  Number of variables: 20007
  Number of binary variables: 0
  Number of integer variables: 2
  Number of continuous variables: 20005
  Number of nonzeros: 64016
  Sense: 1
joni
  • 6,840
  • 2
  • 13
  • 20
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Apr 12 '22 at 21:17

1 Answers1

1

In the future, it would be helpful to include the line of your script/model that is generating the error. My guess is that somewhere you are doing:

import pyomo.environ as pyo
solver = pyo.SolverFactory('gurobipy')

The problem is that gurobipy is not a known Pyomo solver. Currently (as of Pyomo through 6.4; although there is an issue in to change this behavior) when Pyomo sees a solver name it doesn't recognize, it assumes it is an ASL solver and returns a generic ASL solver interface object. That interface then assumes that there is an executable that matches the solver name somewhere in the system PATH, and when it can't find an executable, it raises the error you are seeing.

The root cause is that the Gurobi solver is available through different names:

  • gurobi - by default, this communicates with Gurobi using LP files using the gurobi.sh command line interface and falling back on using the gurobipy interface if the command line driver is not available)
  • gurobi_direct - this is a direct interface through gurobipythat avoids writing/reading files
  • gurobi_persistent - this is a persistent version of the direct interface that supports faster model updates / resolves
jsiirola
  • 2,259
  • 2
  • 9
  • 12