Get_entries returns empty list for IrRu3

I believe it used to work fine a few days ago, and the Materials Explorer on the website still finds a single entry mp-862620. However, pymatgen call fails:

mpr.get_entries(‘IrRu3’, property_data=[“material_id”, “elements”, “pretty_formula”, “final_energy_per_atom” ] )

returns an empty list.

I am unable to reproduce your result. Please ensure your API key is the same listed for you at https://materialsproject.org/dashboard and that you have installed a recent version of pymatgen.

from pymatgen import MPRester, __version__

mpr = MPRester()

print(__version__)

mpr.get_entries("IrRu3", property_data=[
    "material_id",
    "elements",
    "pretty_formula",
    "final_energy_per_atom"
])
2018.12.12

[ComputedEntry mp-862620 - Ir2 Ru6
 Energy = -73.7861
 Correction = 0.0000
 Parameters:
 run_type = GGA
 is_hubbard = False
 pseudo_potential = {'functional': 'PBE', 'labels': ['Ir', 'Ru_pv'], 'pot_type': 'paw'}
 hubbards = {}
 potcar_symbols = ['PBE Ir', 'PBE Ru_pv']
 oxide_type = None
 Data:
 oxide_type = None
 material_id = mp-862620
 elements = ['Ir', 'Ru']
 pretty_formula = IrRu3
 final_energy_per_atom = -9.22326554]

Thanks Donny, the problem seems to be with pymatgen version. I’ve been using 3.2.5 as I was running on a system running python 2.

A bit confused though: the old version does work with most other materials – why does it work most of the time but fails for this one? Also, I thought pymatgen was backwards compatible (only new functionality & bug fixes are supposed to be missing), is it not? How can I tell if a pymatgen version that I use is too old?

Thanks!

Pymatgen is not always backwards compatible. Before transitioning to date-based versioning (e.g. v2019.2.28), backwards-incompatible changes were signaled with a bump in the “minor” version (middle number), e.g. 3.3.x MAY (not necessarily) be incompatible with 3.2.x. I’ve raised an issue on pymatgen’s core repository to determine the backwards-compatibility policy if any going forward.

Regarding versions, the Python community as a whole is moving away from Python 2 support, for example new versions of numpy will support Python 3 only from Jan 2019, and Python itself is officially dropping support from January 2020. Following these examples, pymatgen also is only supporting Python 3 from January 2019 going forwards.

In general, we would strongly recommend you use Python 3 if it’s possible for you to do so, and then usually recommend using the latest pymatgen release (pip install pymatgen --upgrade is an easy way to do this, or the equivalent conda command). A full changelog is available here. Many changes involve bug fixes, which is why using the latest release is recommended.

1 Like

And if you do require Python 2, the final supported Python 2 version is v2018.12.12, so this would be the recommended version.

1 Like

Thanks Matt, that’s helpful. (and yes I do intend to move everything to python 3, alas not there yet…)