I am trying to use legacy pymatgen.ext.matproj MPRester as I am unable to install the new mp-api. When I used the MPRester with my api key from the materials project website it says invalid key.
from pymatgen.ext.matproj import MPRester
with MPRester(api_key="MY_KEY") as mpr:
data = mpr.get_dos_by_material_id("mp-23193")
Hi @Kai_Duemmler , out of curiosity, why are you unable to install the new API? If you can post a stacktrace or something I can pass that on to our team to investigate (if needed). We really do recommend moving to the new API if possible.
The API_KEY for the legacy API is not the same as the key you need for the new API, and I suspect that might be what’s causing your problem. So, if you are obtaining your API_KEY from the legacy MP website, that one should work with the legacy API. If you obtain your key from the new website (next-gen.materialsproject.org/), that key would work only with the new API.
Hope that helps!
Thanks @rkingsbury, agreed. If it’s helpful, there’s some more information in our documentation:
Hello @rkingsbury I use anaconda on a windows 10 machine with python 3.10.2 installed. The error message I get with conda install is package not found error. Is there a specific channel it should be installed from? Thank you @mkhorton I didn’t realize there where 2 API keys and I was using the one from my dashboard from the main website.
Hi Kai, I don’t think
mp-api supports python 3.10 yet @munrojm
Hi @Kai_Duemmler it sounds like you are trying to
conda install mp-api, which I don’t believe is supported (we don’t have a conda package). Instead try
pip install mp-api.
@rkingsbury I was able to install the mp-api on a new environment with python 3.9 and I got mprester to work.
Thank you for the assistance.