def ShowDuals(ampl):
import fractions
# display all duals
print("The dual variable corresponding to:\n")
for c in ampl.get_constraints():
print("- the constraint on", c[0],
"is equal to ",
str(c[1].dual()))
#str(fractions.Fraction(c[1].get_value())), end="")
ShowDuals(ampl)
Cbc installable via coin does not return duals. Check this model: