Error Message from SolverFactory() .

7 views
Skip to first unread message

Palm

unread,
Feb 13, 2011, 11:14:13 AM2/13/11
to coopr forum
Hi,everyone! Any help is appreciated :)
I tried to solve a model instance in a python script by applying
SolverFactory().
The code I wrote is the following:


# initialize the instance.
sub_mdl = import_file("Benders.py").model
# Load the data and build a model instance
sub_inst = sub_mdl.create("Benders.dat")
opt=coopr.opt.SolverFactory("cplex")
results=opt.solve(sub_inst)


But the when I run the script, the error messages are the following:


Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
results=opt.solve(sub_inst)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/coopr.opt-2.4.1-py2.7.egg/coopr/opt/base/
solver.py", line 147, in solve
self._presolve(*args, **kwds)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/coopr.plugins-2.5-py2.7.egg/coopr/plugins/mip/
CPLEX.py", line 175, in _presolve
ILMLicensedSystemCallSolver._presolve(self, *args, **kwds)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/coopr.opt-2.4.1-py2.7.egg/coopr/opt/solver/
shellcmd.py", line 92, in _presolve
OptSolver._presolve(self, *args, **kwds)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/coopr.opt-2.4.1-py2.7.egg/coopr/opt/base/
solver.py", line 161, in _presolve
self.available()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/coopr.opt-2.4.1-py2.7.egg/coopr/opt/solver/
ilmcmd.py", line 32, in available
if not shellcmd.SystemCallSolver.available(self, exception_flag):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/coopr.opt-2.4.1-py2.7.egg/coopr/opt/solver/
shellcmd.py", line 52, in available
raise ApplicationError, msg % self.name
ApplicationError: No executable found for solver 'cplex'



I can solve the problem in the command line by typing : pyomo --
solver=cplex Benders.py Benders.dat
So the solver path is correctly configured. Could someone give me some
ideas of what is going on here?
Thanks a lot in advance!!!

David Woodruff

unread,
Feb 14, 2011, 5:34:38 PM2/14/11
to coopr...@googlegroups.com
I cannot give you any idea what is going on, but I can confirm that on
some computers I have also had trouble with the path in scripts. I
have not had time to track it down. For me the solution on those
machines has been to run my scripts under pyomo rather than under
python because the paths seem to be correct under pyomo.
Dave

Palm

unread,
Feb 14, 2011, 9:58:01 PM2/14/11
to coopr forum
Thanks a lot David!
Error messages showed up when I ran the script on the Mac. Then I ran
my code on a PC with windows 7, no problems at all!
Thanks again!!

On Feb 14, 5:34 pm, David Woodruff <david.l.woodr...@gmail.com> wrote:
> I cannot give you any idea what is going on, but I can confirm that on
> some computers I have also had trouble with the path in scripts. I
> have not had time to track it down. For me the solution on those
> machines has been to run my scripts under pyomo rather than under
> python because the paths seem to be correct under pyomo.
> Dave
>

Yifan Liu

unread,
Feb 14, 2011, 9:57:13 PM2/14/11
to coopr...@googlegroups.com
Thanks a lot David!
Error messages showed up when I ran the script on the Mac. Then I ran my code on a PC with windows 7, no problems at all!
Thanks again!!

--
Yifan Liu               
PhD in Operations Research
Department of Integrated Systems Engineering
The Ohio State University

Bill Hart

unread,
Feb 15, 2011, 7:06:59 PM2/15/11
to coopr forum
The pyomo command _does_ modify the user's PATH environment. However,
it isn't done in a way that would make cplex show up.

Hmmmm

On Feb 14, 3:34 pm, David Woodruff <david.l.woodr...@gmail.com> wrote:
> I cannot give you any idea what is going on, but I can confirm that on
> some computers I have also had trouble with the path in scripts. I
> have not had time to track it down. For me the solution on those
> machines has been to run my scripts under pyomo rather than under
> python because the paths seem to be correct under pyomo.
>   Dave
>

David Woodruff

unread,
Feb 15, 2011, 8:20:50 PM2/15/11
to coopr...@googlegroups.com
Good point. My path troubles were related to finding coopr components,
not CPLEX. One suspects that there is some still-unsolved-trouble with
install on his mac.
Dave
Reply all
Reply to author
Forward
0 new messages