AMPL license activation

In the first argument of SolverFactory you should use “baronnl” instead of “baron” since Pyomo will try to use a bar file otherwise.

In case you used the python modules, the code for any solver would be:

!pip install amplpy pyomo -q
!python -m amplpy.modules install <solver-name> -q
!python -m amplpy.modules activate <license-uuid>
from amplpy import modules
import pyomo.environ as pyo
solver_name = "<solver-name>"
solver = pyo.SolverFactory(solver_name+"nl", executable=modules.find(solver_name), solve_io="nl")