'Failed to create solver with name 'gurobipy': Failed to set executable for solver asl. name=gurobipy either does not exist or it is not executable
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
Solution 1:[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 thegurobi.shcommand line interface and falling back on using thegurobipyinterface if the command line driver is not available)gurobi_direct- this is a direct interface throughgurobipythat avoids writing/reading filesgurobi_persistent- this is a persistent version of the direct interface that supports faster model updates / resolves
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | jsiirola |
