I am having a little problem to make my Kaggle API to work properly, these are the steps I have follow up to now. I am working on a VM creaded with Paperspace (Free-P5000)
I requested the API and I acepted the terms of the competition.
I did it manually, I just downloaded the bluebook-for-bulldozers.zip file, and loaded in the VM at storage/archive/bluebook, then from the terminal in the bluebook folder I ran unzip bluebook-for-bulldozers.zip and it worked.
But I would really like to learn how to do it using just the code shown in the jupyter notebook.
@ricardocalleja, are you sure you didn’t create the directory first? Because you keep everything (not only mkdir) under if not path.exists() and yet it prints you ls.
I believe you removed the screen because of the api keys but i believe the whole section with the call was wrapped with if not path.exists(). If the path existed before, and you mentioned you also downloaded it manually, the code didn’t run, you didn’t send api request. Just try to run it without checking for path and see what error message you get.
What i meant is to remove the indentation before api.competition_download_cli and file_extract. Now it only runs if there is no path already created. If you created the path before running this cell it just didn’t send api request.
Ah, great, now i see. I see you accepted the terms so my best guess is the location of your kaggle.json. The default expected location is ~/.kaggle (mind the dot!). After downloading the file, from the location of the file run this and try again:
The error you get it is just kaggle authorization error.
Make sure you have your kaggle.json in ~/.kaggle (the error you show now suggests that you already have .kaggle directory). Run ls ~/.kaggle, you should see the file.
Just run api.competition_download_cli commend in a separate cell
ok, if you want to troubleshoot in the future make sure the ~/.kaggle/kaggle.json exists (you do not have to provide credentials in any other way, now i’m thinking that maybe you created environment variables as in the first screenshot you shared so running unset KAGGLE_USERNAME and unset KAGGLE_KEY could help) and you can run this to test if you still get 401 error:
from kaggle import api
api.competition_download_cli('bluebook-for-bulldozers')
Hi there,
I’m having a similar problem to @ricardocalleja - getting an error “ApiException: (401) Reason: Unauthorised” when I try to download the bulldozers data.
I originally tried to pip install kaggle before reading on to rest of the notebook, and followed instructions online to add kaggle.json to .kaggle folder, which might have messed with the fastbook code somewhat.
A terminal search revealed that I do indeed have the kaggle.json file in .kaggle and I have run chmod 600 so hopefully permissions are correct.
Just after posting, I realised I should try manually downloading data like @ricardocalleja suggested - and that did indeed work, I navigated to ‘bluebook’ folder then ran line kaggle competitions download -c bluebook-for-bulldozers from kaggle website.
So I’m sorted, but would be interested to know what was wrong, and maybe it will help others, so thought I’d keep this up. (let me know if better to take down!)