KeyError: 'CITRINE_KEY issue

from matminer.data_retrieval.retrieve_Citrine import CitrineDataRetrieval
from matminer.data_retrieval.retrieve_MP import MPDataRetrieval

df_citrine = CitrineDataRetrieval().get_dataframe(formula='Si', property='band gap', data_type='EXPERIMENTAL')
df_mp = MPDataRetrieval().get_dataframe(criteria='Si', properties=['band_gap'])

raceback (most recent call last):
  File "C:/Users/Houssam/PycharmProjects/untitled2/eee.py", line 4, in <module>
    df_citrine = CitrineDataRetrieval().get_dataframe(formula='Si', property='band gap', data_type='EXPERIMENTAL')
  File "C:\Users\Houssam\miniconda3\lib\site-packages\matminer\data_retrieval\retrieve_Citrine.py", line 48, in __init__
    api_key = os.environ["CITRINE_KEY"]
  File "C:\Users\Houssam\miniconda3\lib\os.py", line 678, in __getitem__
    raise KeyError(key) from None
KeyError: 'CITRINE_KEY'

Hi Houssam,

To instantiate CitrineDataRetrieval or MPDataRetrieval, you need to provide a Citrine or Materials Project API key. Please create an account in the website and find your API key by visiting the account settings or dashboard page:

Citrine: https://citrination.com/

MP: https://materialsproject.org

You can then add your api_key when instantiating the classes:

cdr = CitrineDataRetrieval(api_key=‘your api_key’)

mpdr = MPDataRetrieval(api_key=‘your api_key’)

In addition, there are some issues in your example usage of CitrineDataRetrieval get_dataframe. For the provided example, it would be something like this:

df_citrine = cdr.get_dataframe(criteria={“formula”: “Si”, “data_type”: “EXPERIMENTAL”}, properties=[“Band gap”])

Please find more in the docs of CitrineDataRetrieval.

Best,
Qi

···

On Saturday, June 1, 2019 at 2:57:43 PM UTC-7, Houssam Houssam wrote:

df_citrine = CitrineDataRetrieval().get_dataframe(formula=‘Si’, property=‘band gap’, data_type=‘EXPERIMENTAL’)
df_mp = MPDataRetrieval().get_dataframe(criteria=‘Si’, properties=[‘band_gap’])

raceback (most recent call last):
File “C:/Users/Houssam/PycharmProjects/untitled2/eee.py”, line 4, in
df_citrine = CitrineDataRetrieval().get_dataframe(formula=‘Si’, property=‘band gap’, data_type=‘EXPERIMENTAL’)
File “C:\Users\Houssam\miniconda3\lib\site-packages\matminer\data_retrieval\retrieve_Citrine.py”, line 48, in init
api_key = os.environ[“CITRINE_KEY”]
File “C:\Users\Houssam\miniconda3\lib\os.py”, line 678, in getitem
raise KeyError(key) from None
KeyError: ‘CITRINE_KEY’

from matminer.data_retrieval.retrieve_Citrine import CitrineDataRetrieval
from matminer.data_retrieval.retrieve_MP import MPDataRetrieval

Note that this question has also already been answered awhile ago …
https://groups.google.com/forum/#!searchin/matminer/citrine$20key|sort:date/matminer/j9oyNLo6KoA/NShZ7HWFAAAJ

HI
i missing that thanks

···

Le dimanche 2 juin 2019 01:27:27 UTC+1, Anubhav Jain a écrit :

Note that this question has also already been answered awhile ago …
https://groups.google.com/forum/#!searchin/matminer/citrine$20key|sort:date/matminer/j9oyNLo6KoA/NShZ7HWFAAAJ

thanks Qi
its working

···

Le dimanche 2 juin 2019 00:27:08 UTC+1, Qi Wang a écrit :

Hi Houssam,

To instantiate CitrineDataRetrieval or MPDataRetrieval, you need to provide a Citrine or Materials Project API key. Please create an account in the website and find your API key by visiting the account settings or dashboard page:

Citrine: https://citrination.com/

MP: https://materialsproject.org

You can then add your api_key when instantiating the classes:

cdr = CitrineDataRetrieval(api_key=‘your api_key’)

mpdr = MPDataRetrieval(api_key=‘your api_key’)

In addition, there are some issues in your example usage of CitrineDataRetrieval get_dataframe. For the provided example, it would be something like this:

df_citrine = cdr.get_dataframe(criteria={“formula”: “Si”, “data_type”: “EXPERIMENTAL”}, properties=[“Band gap”])

Please find more in the docs of CitrineDataRetrieval.

Best,
Qi

On Saturday, June 1, 2019 at 2:57:43 PM UTC-7, Houssam Houssam wrote:

df_citrine = CitrineDataRetrieval().get_dataframe(formula=‘Si’, property=‘band gap’, data_type=‘EXPERIMENTAL’)
df_mp = MPDataRetrieval().get_dataframe(criteria=‘Si’, properties=[‘band_gap’])

raceback (most recent call last):
File “C:/Users/Houssam/PycharmProjects/untitled2/eee.py”, line 4, in
df_citrine = CitrineDataRetrieval().get_dataframe(formula=‘Si’, property=‘band gap’, data_type=‘EXPERIMENTAL’)
File “C:\Users\Houssam\miniconda3\lib\site-packages\matminer\data_retrieval\retrieve_Citrine.py”, line 48, in init
api_key = os.environ[“CITRINE_KEY”]
File “C:\Users\Houssam\miniconda3\lib\os.py”, line 678, in getitem
raise KeyError(key) from None
KeyError: ‘CITRINE_KEY’

from matminer.data_retrieval.retrieve_Citrine import CitrineDataRetrieval
from matminer.data_retrieval.retrieve_MP import MPDataRetrieval