Question About Setting Up BARON Solver

I am confused on why my code in VS code that uses python says that BARON does not have a license. I set up everything but the terminal seems to not see the license since it is cloud based.

1 Like

Hi @DeGoodma5,

Thank you for reaching out. Did you activate your license with python -m amplpy.modules activate <license-uuid>? Could you please check the output of python -m amplpy.modules run ampl -v to confirm that your license is active.

Yes I made sure to do that. I also added the license file to the folder with the BARON .exe

Was it a license obtained elsewhere? You case you are using an AMPL Community Edition license, it only accepts licenses obtained from AMPL.

No I got it directly from AMPL

I got it from AMPL CE and its cloud based

Which ampl.lic file did you put next to baron.exe? With AMPL CE there should be only one license file and activated using the UUID. Copying ampl.lic files is a non-standard procedure.

Could you please send us the output of python -m amplpy.modules run baron -v and python -m amplpy.modules run ampl -vvq? These outputs will include the license information and location.

What do you mean by output? Do you mean a screenshot? Also I directly downloaded it and moved it to the folder. I did not copy the license file.

It can be a screenshot or you can just copy what is printed on the console when you run these commands.

The issue is that Baron is now recognized but for some reason it can read the file. I am not sure what is going on now.

For example when I see the version of BARON I get the following:

C:\Users\delon>baron -v
BARON 25.8.5 (2025.08.05) (Windows AMD64), driver(20250814), ASL(20241202)
Licensed to AMPL Academic Community Edition License for dgoodma5@kent.edu.
Temporary license expires 20261017.
Using license file “C:\Users\delon\AMPL\ampl.lic”.

This shows that I have it. I Also do ha a ampl file that has all of the solvers including BARON and a license file.

To use our solvers with Pyomo, please flow the instructions at AMPL Modules for Python — AMPL Resources.

1 Like

I followed the guide but now I am getting the following error:

PS C:\Users\dgoodma5\Desktop\AAMEN Project\Optimizer Code> & C:/Users/dgoodma5/AppData/Local/Programs/Python/Python312/python.exe “c:/Users/dgoodma5/Desktop/AAMEN Project/Optimizer Code/BARON_Test1.py”
C:\Users\dgoodma5\AMPL\baron.exe: can’t open C:\TEMP_B~1\tmp23x2rbmt.pyomo.bar.nl
ERROR: Solver (baron) returned non-zero return code (1)
ERROR: See the solver log above for diagnostic information.
Traceback (most recent call last):
File “c:\Users\dgoodma5\Desktop\AAMEN Project\Optimizer Code\BARON_Test1.py”, line 40, in
results = solver.solve(model, tee=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\dgoodma5\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyomo\opt\base\solvers.py”, line 654, in solve
raise ApplicationError("Solver (s) did not exit normally" self.name)
pyomo.common.errors.ApplicationError: Solver (baron) did not exit normally

Could you please send us the line where you instantiate pyo.SolverFactory?