# I cannot link Pyomo with AMPL libraries

**URL:** <https://discuss.ampl.com/t/i-cannot-link-pyomo-with-ampl-libraries/2153>\
**Category:** Support\
**Created:** [June 2, 2025, 4:23pm UTC](https://discuss.ampl.com/t/i-cannot-link-pyomo-with-ampl-libraries/2153 "2025-06-02T16:23:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MIGUEL\_MAYO\_MARTINEZ](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/miguel_mayo_martinez/32/951_2.png) [@MIGUEL\_MAYO\_MARTINEZ](https://discuss.ampl.com/u/MIGUEL_MAYO_MARTINEZ)\
**Post date:** [June 2, 2025, 4:23pm UTC](https://discuss.ampl.com/t/i-cannot-link-pyomo-with-ampl-libraries/2153/1 "2025-06-02T16:23:10Z")

</div>

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:

```auto
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:

```auto
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

---

<div class="post-metadata">

**Author:** ![4er](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/4er/32/530_2.png) [@4er](https://discuss.ampl.com/u/4er)\
**Post date:** [June 3, 2025, 8:16pm UTC](https://discuss.ampl.com/t/i-cannot-link-pyomo-with-ampl-libraries/2153/2 "2025-06-03T20:16:11Z")

</div>

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](http://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.
