Ah, thanks for the clarification. The source of the error isn’t pymatgen, it’s the web data. The reason this code produces an error is because GdFe2 does not have an elastic tensor available on the web site (more specifically, data[‘elasticity’] is a null value because there isn’t elastic tensor data with GdFe2).
Currently, the MP database includes ~7000 elastic tensors, meaning that ~63000 materials do not have elastic tensor data. For GdFe2, you can request the bulk and shear moduli of the material using the “get predictions” button (see the image below).
If you’d prefer to use the API, you can the predicted bulk and shear moduli this way:
data = mpr.get_data("mp-20089", data_type='pred', prop="elastic_moduli")[0]
k = data['elastic_moduli']['K']
g = data['elastic_moduli']['G']
It’s a bit more involved, but you can estimate the debye temperature (via the speed of sound) from these quantities (the long_v, trans_v, and get_debye_temperature functions demonstrate how we calculate these from bulk/shear moduli and crystal structure). Also, note that the data includes a warning that estimates for bulk and shear moduli for F-block elements are typically not as accurate as those for non-rare-earth elements, so take these estimates with a grain of salt. Feel free to post further questions here if you’re still having issues.