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:
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.
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?
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.