Pyomo with IPOPT

1,796 views
Skip to first unread message

Deepak Agrawal

unread,
Jan 16, 2017, 2:45:45 PM1/16/17
to Pyomo Forum
Hi, 

I am trying to run pyomo with ipopt. I have an Ipopt executable, which I can run from command line. But when I use

solver  = SolverFactory('ipopt')
results = solver.solve(m,tee=False)

i get this following error

WARNING: "[base]/site-packages/pyomo/opt/base/solvers.py", 201, __solver_call__
Traceback (most recent call last):
	Failed to create solver with name 'ipopt':
  File "/home/deepak/Downloads/ipopt_example.py", line 44, in <module>
	Failed to set executable for solver asl. File with name=ipopt either does not exist or it is not executable. To skip this validation, call set_executable with validate=False.
    results = solver.solve(m,tee=False)
  File "/home/deepak/anaconda2/lib/python2.7/site-packages/pyomo/opt/base/solvers.py", line 126, in solve
    self._solver_error('solve')
  File "/home/deepak/anaconda2/lib/python2.7/site-packages/pyomo/opt/base/solvers.py", line 154, in _solver_error
    + "\n\toptions: %s" % ( self.options, ) )
RuntimeError: Attempting to use an unavailable solver.

The SolverFactory was unable to create the solver "ipopt"
and returned an UnknownSolver object.  This error is raised at the point
where the UnknownSolver object was used as if it were valid (by calling
method "solve").

The original solver was created with the following parameters:
	executable: ipopt
	type: ipopt
	_args: ()
	options: {}

Thank you in advance for your help.

Gabriel Hackebeil

unread,
Jan 16, 2017, 3:33:24 PM1/16/17
to pyomo...@googlegroups.com
I think the only way this can happen is if the location of ipopt is not in your PATH. If you can run ipopt from the command line from any directory, then something must be wrong. I think this can happen sometimes if you are running your script from within an IDE.

As a last resort, you can provide an absolute path to the executable you want the solver to use via the executable keyword:

solver = SolverFactory(‘ipopt’, executable=‘/home/myname/Ipopt/build/bin/ipopt’)

Gabe

--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages