# Issue with BARON licence AMPLpy + Pyomo

**URL:** <https://discuss.ampl.com/t/issue-with-baron-licence-amplpy-pyomo/2120>\
**Category:** Support\
**Created:** [April 19, 2025, 7:57pm UTC](https://discuss.ampl.com/t/issue-with-baron-licence-amplpy-pyomo/2120 "2025-04-19T19:57:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ghosty](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/ghosty/32/932_2.png) [@Ghosty](https://discuss.ampl.com/u/Ghosty)\
**Post date:** [April 19, 2025, 7:57pm UTC](https://discuss.ampl.com/t/issue-with-baron-licence-amplpy-pyomo/2120/1 "2025-04-19T19:57:37Z")

</div>

Hi everyone,

I am working with pyomo and using AMPL solvers, here’s the code + error. I have activated the trial for BARON, but unabel to use, It’s working fine with other free solvers.

from amplpy import modules  
solver\_name = “baron” # “highs”, “cbc”, “couenne”, “bonmin”, “ipopt”, “scip”, or “gcg”.  
solver = SolverFactory(solver\_name+“nl”, executable=modules.find(solver\_name), solve\_io=“nl”)

Computed 1-4-1-f7b21632 DESKTOP-TODD7A6 18-1D-EA-AE-73-84 1A-1D-EA-  
AE-73-83 00-FF-BD-E9-FE-55 18-1D-EA-AE-73-83 38AA-40D2

```
HOSTINFO.NPROC.12 HOSTINFO.CORES.6 No baron license for this machine.
baron (Windows AMD64), licchk(20250308), ASL(20241202)

```

“c:\Program Files\Python3913\lib\site-packages\ampl\_module\_base\bin\ampl.lic”:

# Temporary BARON, CPLEX, GUROBI, XPRESS, COPT, MOSEK, XPRESSGLOBAL, # AMPL,

CONOPT, KNITRO, LGO, LINDOGLOBAL, LOQO, MINOS, SNOPT & OCTERACT # single-  
machine server license expiring 20260419 and 20250519 (BARON) # licensed to  
AMPL Academic Community Edition License for #

---

<div class="post-metadata">

**Author:** ![fdabrandao](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/fdabrandao/32/63_2.png) [@fdabrandao](https://discuss.ampl.com/u/fdabrandao)\
**Post date:** [April 19, 2025, 9:13pm UTC](https://discuss.ampl.com/t/issue-with-baron-licence-amplpy-pyomo/2120/2 "2025-04-19T21:13:24Z")

</div>

Hi @Ghosty,

Could you please check the content of the `amplkey.log` file that should be at `c:\Program Files\Python3913\lib\site-packages\ampl_module_base\bin\amplkey.log`?

Please note that this license requires a permanent internet connection to work.

Another issue is that the license file must be on a location with write permissions which may not be the case for `c:\Program Files\Python3913\lib\site-packages`. It is recommended to use virtual environments on the user home folder.

---

<div class="post-metadata">

**Author:** ![Ghosty](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/ghosty/32/932_2.png) [@Ghosty](https://discuss.ampl.com/u/Ghosty)\
**Post date:** [April 20, 2025, 7:39am UTC](https://discuss.ampl.com/t/issue-with-baron-licence-amplpy-pyomo/2120/3 "2025-04-20T07:39:55Z")

</div>

Hii,

First thankyou for responding,

Second, its able to access the contents of the license file, btw the error code has changed a bit,

Before 440 | 7979 ||| License file [c:\Program](file:///C:/Program) Files\Python3913\lib\site-packages\ampl\_module\_base\bin\ampl.lic: Today = 20250420; found license file “c:\Program Files\Python3913\lib\site-packages\ampl\_module\_base\bin\ampl.lic”: # Temporary BARON, CPLEX, GUROBI, XPRESS, COPT, MOSEK, XPRESSGLOBAL, # AMPL, CONOPT, KNITRO, LGO, LINDOGLOBAL, LOQO, MINOS, SNOPT & OCTERACT # single-machine server license expiring 20260419 and 20250519 (BARON) # licensed to AMPL Academic Community Edition License for # [2022me314@student.uet.edu.pk](mailto:2022me314@student.uet.edu.pk): 6803fae3 e116fad7 07caf263 b2d890af 44bdb579 b8d11767 36e7b2c9 418ad73d 535f90d3 aa37bee7 b703f338 40ca2e6f 3d6dcb45 c187e4db 30a7b6cc c504bb58 dbe7b88a d7e312ce 876e65f0 d3a634c1 219dedf8 1623981b 2638a1cc 530401ee …

Computed 1-4-1-f7b21632  
DESKTOP-TODD7A6  
18-1D-EA-AE-73-84  
1A-1D-EA-AE-73-83  
00-FF-BD-E9-FE-55  
18-1D-EA-AE-73-83  
38AA-40D2

HOSTINFO.NPROC.12  
HOSTINFO.CORES.6  
No baron license for this machine.  
baron (Windows AMD64), licchk(20250308), ASL(20241202)  
ERROR: Solver (asl) returned non-zero return code (2)  
ERROR: See the solver log above for diagnostic information.

as for internet connection, its running fine too.

---

<div class="post-metadata">

**Author:** ![fdabrandao](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/fdabrandao/32/63_2.png) [@fdabrandao](https://discuss.ampl.com/u/fdabrandao)\
**Post date:** [April 20, 2025, 1:07pm UTC](https://discuss.ampl.com/t/issue-with-baron-licence-amplpy-pyomo/2120/4 "2025-04-20T13:07:50Z")

</div>

Hi @Ghosty,

How did you activate the license? Were you doing it as an administrator? If the modules are installed on a folder where only an administrator has write access, they can only be used by administrators.

---

<div class="post-metadata">

**Author:** ![Ghosty](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/ghosty/32/932_2.png) [@Ghosty](https://discuss.ampl.com/u/Ghosty)\
**Post date:** [April 21, 2025, 6:26pm UTC](https://discuss.ampl.com/t/issue-with-baron-licence-amplpy-pyomo/2120/5 "2025-04-21T18:26:40Z")

</div>

First time, as admin, but i have already tried, uninstalling and installing on a user folder,

also doesnt the error indicates something else?

log output, prints the license file, (updated one/latest) and at the last this

```
HOSTINFO.NPROC.12 HOSTINFO.CORES.6 No baron license for this machine.
baron (Windows AMD64), licchk(20250308), ASL(20241202)

```

it’s able to read the license file, so i dont think, admin perms is the issue here?? maybe, besides, i am able to work with other solvers that come under coin package, only these trial solvers, are throwing errors

---

<div class="post-metadata">

**Author:** ![fdabrandao](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/fdabrandao/32/63_2.png) [@fdabrandao](https://discuss.ampl.com/u/fdabrandao)\
**Post date:** [April 21, 2025, 9:29pm UTC](https://discuss.ampl.com/t/issue-with-baron-licence-amplpy-pyomo/2120/6 "2025-04-21T21:29:27Z")

</div>

Hi @Ghosty,

It is necessary to have write permissions since the license file is updated every 5 minutes.

Could you please send us the output of:

```bash
$ python -m amplpy.modules run amplkey show log

```
