I cannot link Pyomo with AMPL libraries

Good afternoon,

I tried to link Pyomo with AMPL but I’m not able to do it. First I have downloaded pyomo , then I have dowloaded AMPL libraries (i.e. conopt , I got license) but when I add the solver as:

solver = pyo.SolverFactory('conopt',executable="/Applications/AMPL/conopt", solve_io="nl")
opt = SolverFactory(solver)
opt.options['halt_on_ampl_error'] = 'yes'
opt.options['max_iter'] =40000
solver_manager = SolverManagerFactory('serial')
results = solver_manager.solve(model, opt=opt, tee=**True**, timelimit=**None**)

it appears:

ERROR: Unexpected exception while loading model:
        Attempting to use an unavailable solver.

The SolverFactory was unable to create the solver
"<pyomo.solvers.plugins.solvers.CONOPT.CONOPT object at 0x7fccb07432e0>"
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: <pyomo.solvers.plugins.solvers.CONOPT.CONOPT object at 0x7fccb07432e0>
type: <pyomo.solvers.plugins.solvers.CONOPT.CONOPT object at 0x7fccb07432e0>
_args: () options: {'halt_on_ampl_error': 'yes', 'max_iter': 40000}

I have also copy the license on the python folders

It appears that you are trying to use Pyomo with a version of CONOPT that reads AMPL .nl files. This is not specifically an AMPL issue, but if you can provide the following information, we may be able to point you in the right direction:

  • Did you get CONOPT from portal.ampl.com?
  • What output do you see when you execute
    /Applications/AMPL/conopt -v
    in a command window?
  • What is in your license file? You can copy the contents into your reply, or upload it with your reply.