Amplpy uses an older version for Gurobi when callbacks are used

I am trying to solve a problem using callbacks in amply with gurobi. My problem has two stages, in the first one a relaxed model is solved, while in the second one the integral model is solved using callbacks. My version of gurobi is 10.0.1., and as expected, amplpy uses gurobi 10.0.1. for the relaxed stage, but I am surprised that it uses gurobi 9.1.2 (Gurobi Optimizer version 9.1.2 build v9.1.2rc0 (win64)) for the second part (which makes the solution process slower). So, I don’t know if it is a bug or gurobi 10.0.1. doesn’t support callbacks. Please let me know if you know how to prevent this issue in order to use the latest version of gurobi while using callbacks.


Hello Johnatan,

apologies for this; amplpy_gurobi is an indepentent module (and indeed it does not depend on amplpy to work at all); this is because, since it provides access to low-level solver functionalities, it has to be linked with a specific version of the solver.
Having said so, the current version (amplpy_gurobi 0.1.2) should come with gurobi 10.0.1; also please update on a regular basis, as we are on a short development cycle: Releases ampl/ampls-api (

You can update the currently installed module with:

pip install --upgrade amplpy_gurobi

Hope this helps!

Thanks for your response, it helped me. I would like to add that currently I am using amplpy-gurobi==0.1.0b18 because amplpy_gurobi 0.1.1 has an issue with the function AMPL.export_model(). I already reported this issue and I know that it will be solved soon, so I will be waiting for that.