Function Repository Resource:

KaggleInstall

Source Notebook

Install the Kaggle API on the user's machine

Contributed by: Julián Laverde and Siria Saddedin

ResourceFunction["KaggleInstall"][]

installs Kaggle using the API credentials located in the user's $HomeDirectory.

ResourceFunction["KaggleInstall"][path]

installs Kaggle using the file containing the API credentials located in path.

ResourceFunction["KaggleInstall"][username,key]

installs Kaggle using the API credentials username and key.

ResourceFunction["KaggleInstall"]["Test"]

returns a Success object if the Kaggle API is installed and working properly, and a Failure object otherwise.

Details

Kaggle is an online community of data scientists and machine learning practitioners where users find and publish data sets, explore and build models in a web-based data science environment, work with other data scientists and machine learning engineers and enter competitions to solve data science challenges.
ResourceFunction["KaggleInstall"] requires Python. For help configuring the Python evaluator, see Configure Python for ExternalEvaluate.
ResourceFunction["KaggleInstall"][] requires a kaggle.json file that contains the user’s credentials. To obtain an API key, you must first register for an account at www.kaggle.com. Then visit https://www.kaggle.com/<username>/account, click "Create New API Token". You will be prompted to save a "kaggle.json" file; the recommended location $HomeDirectory/.kaggle :
ResourceFunction["KaggleInstall"][] attempts to install Kaggle and returns a Success object if it was successfully installed and a Failure object otherwise.
ResourceFunction["KaggleInstall"]["Test"] returns a Success object if Kaggle is installed and the authentication is successful. ResourceFunction["KaggleInstall"]["Test"] returns a Failure object if either the kaggle.json file is missing or if the authentication credentials are incorrect.

Examples

Basic Examples (3) 

Install Kaggle:

In[1]:=
ResourceFunction["KaggleInstall"][]
Out[1]=

Install Kaggle using your API credentials:

In[2]:=
ResourceFunction[
 "KaggleInstall"]["username", "8cd2f0bcef33ce463b9045154d2db22e"]
Out[2]=

Alternatively, provide the path to the kaggle.json file with your credentials in your system:

In[3]:=
ResourceFunction[
 "KaggleInstall"]["C:/Users/username/Downloads/kaggle.json"]
Out[3]=

KaggleInstall["Test"] returns Success if the installation of the Kaggle API is correct:

In[4]:=
ResourceFunction["KaggleInstall"]["Test"]
Out[4]=

Scope (3) 

KaggleInstall["Test"] returns Failure if the kaggle.json file is missing:

In[5]:=
ResourceFunction["KaggleInstall"]["Test"]
Out[5]=

KaggleInstall["Test"] returns Failure if the package has not been installed or the kaggle.json file does not contain the credentials in the correct format:

In[6]:=
ResourceFunction["KaggleInstall"]["Test"]
Out[6]=

KaggleInstall["Test"] returns Failure if your kaggle.json file has the wrong credentials:

In[7]:=
ResourceFunction["KaggleInstall"]["Test"]
Out[7]=

Possible Issues (2) 

Used without arguments, KaggleInstall[] requires the credentials file to be located in your $HomeDirectory:

In[8]:=
ResourceFunction["KaggleInstall"][]
Out[8]=

Make sure the kaggle.json file is located in the path provided:

In[9]:=
ResourceFunction[
 "KaggleInstall"]["C:/Users/username/Downloads/kggle.json"]
Out[9]=
In[10]:=
ResourceFunction[
 "KaggleInstall"]["C:/Users/username/Downloads/kaggle.json"]
Out[10]=

Publisher

WolframSpecialProjects

Version History

  • 1.0.0 – 16 March 2021

Related Resources

License Information