We installed Kaggle's command-line tool and its Python library, kagglehub, in a fresh virtual environment on Windows 11 on 1 December 2026, read the CLI's documentation, changelog and source code on GitHub, and ran every command that works without an account. The first command failed, public downloads worked signed out, and the error messages below come from our terminal or from the tool's own code.
The short answer: install with pipx install kaggle or pip install kaggle (Python 3.11 or later; the current release is 2.2.5). Sign in with kaggle auth login, which opens a browser, or generate an API token under Settings › API on kaggle.com: it starts with KGAT_ and goes in the KAGGLE_API_TOKEN environment variable or a file at ~/.kaggle/access_token. kaggle.json still works, but Kaggle now files it under "Legacy API Credentials". Then kaggle datasets download owner/name --unzip fetches a dataset, and public datasets download even when signed out. Competitions refuse until you join and accept the rules on the website. Checked 1 December 2026.
Fastero
Connect your database. Ask questions. Get dashboards.
Postgres, BigQuery, Snowflake, and 10+ sources — live-connected, AI-powered, no dashboard builder learning curve.
Try free →Kaggle CLI cheat sheet

The commands this guide covers, with the sign-in column from our own runs on 1 December 2026: public dataset files and downloads worked with no credentials, everything else asked us to sign in.
How to install the Kaggle CLI
Kaggle's docs say "Note: Ensure you have Python 3.11+." and recommend pipx or uv, which keep the CLI in its own environment. Plain pip inside a virtual environment works too, and it's what we used:
python -m venv .venv
.venv\Scripts\activate # macOS and Linux: source .venv/bin/activate
pip install kaggle
kaggle --versionThat installed kaggle 2.2.5, kagglesdk 0.1.38 and python-dateutil 4.0.0. The first command then failed:
$ kaggle --version
Traceback (most recent call last):
[traceback trimmed]
File "...\site-packages\kaggle\models\upload_file.py", line 22, in <module>
import six
ModuleNotFoundError: No module named 'six'
exit code: 1Every kaggle command fails this way, because the CLI imports a module it never declared and used to get through python-dateutil, which dropped it in version 4.0.0. The changelog lists the fix under its next, unreleased version. Until then:
$ pip install six
$ kaggle --version
Kaggle CLI 2.2.5
exit code: 0Two other install errors the docs cover: error: externally-managed-environment on recent Debian and Ubuntu (use pipx or uv), and Command kaggle not found, which means pip's scripts folder isn't on your PATH (~/.local/bin for a user install on Linux).
Kaggle API key: the new token, OAuth or kaggle.json
The CLI accepts four kinds of credentials. As of version 2.2.5:
| Method | Where it lives | Best for |
|---|---|---|
kaggle auth login |
A browser sign-in; the CLI caches it in ~/.kaggle/credentials.json |
Your own laptop |
KAGGLE_API_TOKEN |
An environment variable holding a KGAT_... token |
CI, servers, Colab |
~/.kaggle/access_token |
A text file holding only the KGAT_... token |
Your own laptop |
kaggle.json (legacy) |
{"username": "...", "key": "..."} in ~/.kaggle/, or KAGGLE_USERNAME and KAGGLE_KEY |
Older scripts and tools |
To get a token, sign in to kaggle.com, open Settings, and in the API section click "Generate New Token". The kaggle.json file comes from a separate button under "Legacy API Credentials", labeled "Create Legacy API Key". The CLI's own sign-in message recommends the first row: "Recommended: log in with OAuth via a web-based authorization flow."
The token arrived in two steps: token files need CLI 1.8 or later, which reached PyPI on 21 November 2025, and kaggle auth login was documented in 2.1.1 (5 May 2026). That explains two reports on the CLI's GitHub: someone generates a new token, runs an old CLI, and gets OSError: Could not find kaggle.json. Versions before 1.8 only know the legacy username and key. Upgrading fixes it, but 1.8.0 and later need Python 3.11, so on an older Python pip quietly keeps installing 1.7.4.5, the last release that allows 3.7.
Where does kaggle.json go?
- macOS and Linux:
~/.kaggle/kaggle.json. On Linux, if~/.kaggledoesn't exist, the CLI uses~/.config/kaggle/instead. - Windows:
C:\Users\<you>\.kaggle\kaggle.json. - Anywhere else: set
KAGGLE_CONFIG_DIRto the folder that holds it.
The token file is different: the CLI reads ~/.kaggle/access_token from your home folder whatever KAGGLE_CONFIG_DIR says, and on Windows it also accepts access_token.txt, in case Notepad added the extension. On macOS and Linux, lock the file down with chmod 600, or the CLI prints this warning (from its code, with your full path; Windows skips the check):
Warning: Your Kaggle API key is readable by other users on this system! To fix this, you can run 'chmod 600 /home/you/.kaggle/kaggle.json'When several are set, the CLI tries an access token first, then the legacy key, then the OAuth login. Never paste a token into a notebook you share. Inside a Kaggle notebook you don't need one for kagglehub, and other keys belong in Kaggle Secrets, read with UserSecretsClient, which is "only functional within the Kaggle notebook execution environment". In Colab, keep the token in the Secrets panel under the name KAGGLE_API_TOKEN, which kagglehub reads directly; our Colab secrets guide covers the panel.
kaggle datasets download: datasets from the command line
A dataset's reference is the last two parts of its URL, owner then name: willianoliveiragibin/pixar-films, for example. The CLI's auth docs say "Some commands are allowed logged out, including help/version and selected public dataset file/download flows." We checked that with no credentials anywhere on the machine:
$ kaggle datasets files willianoliveiragibin/pixar-films
name size creationDate
------------------- ---- --------------------------
pixar_films new.csv 2939 2025-03-07 22:43:52.335000
exit code: 0
$ kaggle datasets download willianoliveiragibin/pixar-films -p data --unzip
Dataset URL: https://www.kaggle.com/datasets/willianoliveiragibin/pixar-films
License(s): CC0-1.0
Downloading pixar-films.zip to data
100%|##########| 1.64k/1.64k [00:00<00:00, 1.07MB/s]
exit code: 0The zip was 1.64 KB; --unzip left the 2,939-byte CSV in data and deleted the archive. Searching is different: kaggle datasets list -s "air quality" printed the sign-in message and exited with 1, so list needs credentials even for public data.
Options worth knowing:
-f file.csvdownloads one file instead of the whole dataset.-p folderpicks the folder;-ore-downloads over an existing copy.owner/dataset/3downloads version 3 instead of the latest.--unzipwith-fextracts a large file that Kaggle serves inside a zip of the same name.
One catch from our run: with -f "pixar_films new.csv", the file arrived as pixar_films%20new.csv, its space still URL-encoded. Rename it, or download the whole dataset with --unzip, which kept the real name.
Download competition data, and why you get 403
Competition files need a signed-in account that has joined the competition. Kaggle's tutorial says you must "join the competition and accept the competition's rules on the Kaggle website", and the CLI can't do that step for you. Then:
kaggle competitions download titanic -p data --unzip
kaggle competitions submit titanic -f submission.csv -m "first try" --waitUse the competition's short name from its URL (titanic), not the whole URL: one user's 403, saying the permission competitions.participate was denied, went away when they passed the name alone. --wait blocks until the submission is scored, up to 12 hours by default, and exits with a non-zero code if scoring fails, so it can stop a pipeline.
Push and run a notebook: kaggle kernels push
The CLI calls notebooks "kernels". To run a local .ipynb on Kaggle's machines with no browser open:
-
Create the metadata file.
kaggle kernels init -p mynbwritesmynb/kernel-metadata.json. Edit it:{ "id": "your-username/sales-forecast", "title": "Sales Forecast", "code_file": "sales-forecast.ipynb", "language": "python", "kernel_type": "notebook", "is_private": "true", "enable_gpu": "true", "enable_internet": "false", "machine_shape": "NvidiaTeslaT4", "dataset_sources": ["willianoliveiragibin/pixar-films"] }The slug is the title in lowercase with dashes. If you leave them out,
is_privatedefaults to true, andenable_gpuandenable_internetto false, so a notebook that installs packages needsenable_internetswitched on. -
Push it.
kaggle kernels push -p mynbuploads the notebook, creates a new version and starts running it. Its code then prints a line like this:Kernel version 1 successfully pushed. Please check progress at <url>Add
--accelerator NvidiaTeslaT4for the two T4 GPUs,-t 3600to stop it after an hour, or--no-runto save a version without running it. -
Check on it.
kaggle kernels status you/sales-forecast, with your username in place ofyou. The states in Kaggle's SDK include queued, running, complete and error. -
Collect the results.
kaggle kernels output you/sales-forecastdownloads the files the run wrote (-p outpicks the folder), and--file-pattern ".*\.csv$"limits it to CSVs.
These commands need credentials, so we couldn't run them signed out; they come from Kaggle's docs, the CLI's --help and its source. To pull an existing notebook down first, kaggle kernels pull your-username/slug -m fetches it with its metadata. How long a run may take, and the GPU quota it spends, are in our Kaggle Notebooks guide. To execute a notebook on your own machine instead, see running a notebook from the command line.
Connect any database. Ask in plain English.
Start free →kaggle quota: GPU hours left
kaggle quota, added in 2.2.1, shows the week's GPU and TPU hours as used, remaining, total and refreshAt, and kaggle quota -v prints the same as CSV. Signed out, it prints the sign-in message. What the quota is and how to spend it is covered in our Kaggle GPU guide.
kagglehub: the Kaggle API from Python
kagglehub is Kaggle's Python library for the same downloads. It reads the same token sources as the CLI, plus a Colab secret, and it too needs no sign-in for public datasets. We ran this with kagglehub 1.0.3 and pandas 3.1.2, signed out (progress bar and cache folder trimmed from the output):
import kagglehub
from kagglehub import KaggleDatasetAdapter
path = kagglehub.dataset_download("willianoliveiragibin/pixar-films")
print(path)
df = kagglehub.dataset_load(
KaggleDatasetAdapter.PANDAS,
"willianoliveiragibin/pixar-films",
"pixar_films new.csv",
)
print(df.shape)
print(df[["film", "release_date", "box_office_worldwide"]].head(3).to_string(index=False))Downloading to ...\datasets\willianoliveiragibin\pixar-films\1.archive...
Extracting files...
...\datasets\willianoliveiragibin\pixar-films\versions\1
Download already complete (2939 bytes).
(28, 16)
film release_date box_office_worldwide
Toy Story 1995-11-22 394436586
A Bug's Life 1998-11-25 363258859
Toy Story 2 1999-11-24 511358276dataset_load needs pip install "kagglehub[pandas-datasets]". Files are cached in ~/.cache/kagglehub/ (change it with KAGGLEHUB_CACHE, or pass output_dir), so the second call reused the download. Inside a Kaggle notebook, kagglehub attaches the dataset to the notebook instead of downloading it. Signed out, kagglehub.competition_download("titanic") ended with:
kagglehub.exceptions.UnauthenticatedError: User is not authenticatedUse the CLI for shell scripts, competitions and pushing notebooks; use kagglehub when the next line of code is pandas.
Kaggle API errors and how to fix them
| What you see | Why | Fix |
|---|---|---|
No module named 'six' |
kaggle 2.2.5 with python-dateutil 4.0.0 | pip install six |
| "Authentication required to call the Kaggle API." | No credentials, or the server rejected them: in 2.2.5 a 401 prints this | kaggle auth login, or a new token |
401 - Unauthorized or 401 Client Error: Unauthorized |
Older CLI versions: an expired key, or a competition you haven't joined | New token; join the competition |
403 Client Error: Forbidden |
Not joined, rules not accepted, or a full URL instead of the name | Join and accept the rules on the website |
Could not find kaggle.json |
A CLI older than 1.8 with a new token | Upgrade on Python 3.11+ |
UnauthenticatedError |
kagglehub, signed out, on something that needs an account | Set KAGGLE_API_TOKEN or kagglehub.login() |
Since 2.2.5 the CLI adds a next step to 403 errors: "You don't have access to this resource." followed by "If this is a competition, you may need to accept its rules first" and a link to the rules page. A 404 gets "The resource was not found. Check the spelling of the reference you passed." and a 429 "You have been rate limited."
One mistake gets a clearer message soon. We put a fake KGAT_ token in kaggle.json as the key, and 2.2.5 replied only with "Authentication required to call the Kaggle API." A change merged into the CLI's main branch on 4 November 2026 makes it name the problem and point to ~/.kaggle/access_token or KAGGLE_API_TOKEN instead, once it's released. Until it ships: tokens starting KGAT_ never go in kaggle.json.
After the download: when the data is for your team
Kaggle is the place to get the data and train on it. If the CSV you downloaded is the start of a report other people will read, Fastero is an AI and data platform where people and AI agents work together on a team's data, and it picks up from the file. Download the file with the CLI first, then:
- Upload the CSV to a Fastero project and ask about it in the AI chat, which writes and runs the SQL and builds dashboards and reports. It takes up to 10 files at a time, 50 MB each.
- Open it in a notebook. Notebooks are standard
.ipynbfiles, and they read the project's uploaded files by path with pandas, Excel files too. - Run the notebook on a cron schedule on the server, with no browser open, and keep keys in Secrets, which reach cells as environment variables.
- Share it with a sign-in. Viewers are free, and the Free plan has no end date and needs no card. It includes $20 of AI usage to start, 500 MB of storage and 6 hours a day of notebook and Python run time, on a 1 CPU, 2 GB server per workspace; on Pro, bigger machines up to 8 CPUs and 32 GB, charged by the hour. Plans are on the pricing page.

A CSV uploaded to Fastero's AI chat and turned into a dashboard. Sample data.
FAQ
Where do I find my Kaggle API key?
On kaggle.com, open your account's Settings and go to the API section. "Generate New Token" makes a token starting with KGAT_, for KAGGLE_API_TOKEN or ~/.kaggle/access_token. The older kaggle.json file is under "Legacy API Credentials".
Is kaggle.json deprecated?
Kaggle labels it legacy, and the CLI's help now points people to kaggle auth login or an API token instead. It still worked in CLI 2.2.5 on 1 December 2026, and we found no announced end date. New setups should use a token.
Do I need an API key to download Kaggle datasets?
Not for public datasets: in our test, kaggle datasets download, kaggle datasets files and kagglehub's dataset_download all worked with no credentials. Searching datasets, competition data, private datasets, uploads and pushing notebooks all need you signed in.
Why does kaggle competitions download give 403 Forbidden?
Almost always because the account hasn't joined the competition and accepted its rules on kaggle.com, which the CLI can't do for you. Also pass the competition's short name, such as titanic, rather than its full URL. Invitation-only competitions refuse anyone the host hasn't invited.
How do I use the Kaggle API in Google Colab?
Add your token to Colab's Secrets panel as KAGGLE_API_TOKEN and give the notebook access. kagglehub reads that secret directly. For the CLI, set os.environ["KAGGLE_API_TOKEN"] from userdata.get before the first kaggle command.
What's the difference between the kaggle CLI and kagglehub?
The kaggle CLI covers everything: datasets, competitions, notebooks, models, quota and submissions, from a shell. kagglehub is a Python library for downloading and uploading datasets, models and notebook outputs, and it can load a file straight into pandas. Both use the same credentials.
Sources
Read on 1 December 2026; versions are the ones pip installed that day.
- Kaggle CLI on GitHub: README, installation and authentication, configuration, datasets, competitions, kernels, kernel metadata, tutorials, auth reference, quota reference, changelog, source code
- Kaggle CLI issues: 403 with a full URL (#555), 403 before accepting rules (#87), 403 Client Error in CLI 2.x (#1015), 401 on a competition not joined (#831), 401 Unauthorized (#279), new token with an old CLI (#1188), token needs 1.8 (#886), credential format checks (#1241)
- kagglehub: README
- PyPI: kaggle, kagglehub, kagglesdk
Try Fastero free: upload the CSV you pulled from Kaggle, ask questions of it, and turn the answer into a dashboard your team signs in to read. No credit card required.
Fastero Dev Team