Welcome to the Kaggle CLI documentation. This guide provides detailed information on how to use the Kaggle command-line interface to interact with Kaggle's platform.
Note: Ensure you have Python 3.11+ and the package manager pip installed.
Install the kaggle package with pip:
pip install kaggleIf you run into a Command kaggle not found error, ensure that your Python executable scripts are in your $PATH. For a local user install on Linux, the default location is ~/.local/bin. On Windows, the default location is $PYTHON_HOME/Scripts.
First, you will need a Kaggle account. You can sign up here.
After login, you can download your Kaggle API credentials at https://www.kaggle.com/settings/api by clicking on the "Generate New Token" button under the "API" section.
Obtains access credentials for your Kaggle user accounts via a web-based authrorization flow.
kaggle auth loginexport KAGGLE_API_TOKEN=xxxxxxxxxxxxxx # Copied from the settings UIStore your Kaggle API token obtained from your Kaggle account API tokens settings page in a file at ~/.kaggle/access_token.
From your Kaggle account API tokens settings page, under "Legacy API Credentials", click on the "Create Legacy API Key" button to generate a kaggle.json file and store it at ~/.kaggle/kaggle.json.
Run the following command to list the available commands:
kaggle --helpThe Kaggle CLI is organized into several command groups:
- Competitions: Manage and participate in Kaggle competitions.
- Datasets: Search, download, and manage Kaggle datasets.
- Forums: Browse and read Kaggle discussion forums.
- Kernels: Interact with Kaggle Kernels (notebooks and scripts).
- Models: Manage your Kaggle Models.
- Model Variations: Manage variations of your Kaggle Models.
- Model Variation Versions: Manage versions of your Kaggle Model Variations.
- Benchmarks: Define evaluation tasks, run them against LLM models, and download results.
- Configuration: Configure the Kaggle CLI.
Many commands produce output, which can be formatted for different purposes:
- Output Format: Control the format of output.
Explore these tutorials to learn how to perform common tasks: