Pyomo's SolverFactory cannot create Ipopt (OSX) - possibly related to COIN-OR
Question: I'm trying to use Pyomo to find the optimal values of a Python model on OSX. I
got the script from <https://github.com/shoibalc/recem>, and installed Pyomo
and COIN-OR following the instructions to the extent that I could, changing a
few things that were outdated or didn't seem to work on OSX.

The code that is causing problems is below.

    
    
    import pyomo
    from pyomo.opt.base import *
    from pyomo.opt.parallel import SolverManagerFactory
    from DICE2007 import createDICE2007
    from DICEutils import DICE_results_writer
    
    global start_time
    start_time = time.time()
    
    dice = createDICE2007()
    dice.doc = 'OPTIMAL SCENARIO'
    opt = SolverFactory('ipopt',solver_io='nl') 
    tee = False
    options =   """
            halt_on_ampl_error=yes"""
    solver_manager = SolverManagerFactory('serial')
    
    print '[%8.2f] create model %s OPTIMAL SCENARIO\n' %(time.time()-start_time,dice.name)
    
    instance = dice.create()
    print '[%8.2f] created instance\n' %(time.time()-start_time)
    
    results = solver_manager.solve(instance, opt=opt, tee=tee, options=options, suffixes=['dual','rc'])
    

This crashes on the last ("results") line, with the following error message:

> 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: solver_io: nl
> type: ipopt _args: () options: {} _options_str: []

I'm very new to all this, but thought that maybe Pyomo can't access the ipopt
file it needs, which I think for me is located in the COIN-OR binaries I
downloaded. I tried adding the relevant-seeming files to my PYTHONPATH and
also importing them into the script, which didn't help. Any ideas what I
should try next to either make this work, or to amend the script to something
that would work?


Answer: A colleague of mine had the same issue and he managed to solve it by
generating the solver object with the route to the IPOPT AMPL executable:

    
    
    opt = SolverFactory('/route/to/ipopt',solver_io='nl')
    

