Issue with BARON licence AMPLpy + Pyomo

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 #

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.

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: 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.

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.

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

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:

$ python -m amplpy.modules run amplkey show log