Downloading Kaggle data on Colab: 09_tabular.ipynb

Hi,

I am sharing my solution below for whoever might come across the same difficulties regarding downloading data via the kaggle api for the notebook 09_tabular.ipynb related to the fastai2 book. (if there is a simpler solution please feel free to share it):

  1. As suggested in the notebook download kaggle.json on your computer and upload on colab via the upload button.

  2. Go to the link provided in the notebook to accept the rules for the kaggle data

  3. Make sure you have GPU runtime. After cell one in the notebook I run the following lines (as suggested here)

     ! pip install dtreeviz # this package was not preinstalled either
    
     ! pip install -q kaggle
     ! mkdir ~/.kaggle
     !cd ~
     ! cp kaggle.json ~/.kaggle/
     ! chmod 600 ~/.kaggle/kaggle.json
    
  4. Provide your kaggle credentials as described in the notebook

And 5) I replaced the line path.mkdir() in the following as:

if not path.exists():
    #path.mkdir()
    path.parent.mkdir(exist_ok=True)
    api.competition_download_cli('bluebook-for-bulldozers', path=path)
    file_extract(path/'bluebook-for-bulldozers.zip')

Thanks,
M

1 Like

Shouldn’t the notebook be updated with this changes? The current method in the notebook doesn’t work for me either, and your method works fine.