How To Use Kaggle In Google Colab (Fast.Ai)

profile
Himesh Jain
Aug 08, 2019   •  2 views

After searching for a while, I was able to find a simple way that works as of August 2019. All thanks to nanokaggle on Kaggle Forums.


First lets get the token.json from Kaggle

  1. Visit Kaggle.

  2. Click on your profile picture and then go to my Account.

  3. In the API section click on "Create New API Token" and save the resulting kaggle.json.

Now on to the Colab part

  • We have to import the kaggle.json file into the notebook.

  • For that, run in a cell, the following code:

from google.colab import files
files.upload()
  • Browse to the downloaded kaggle.json file and upload it.

  • Now we will setup the directory structure and everything else

! mkdir -p ~/.kaggle             
! cp kaggle.json ~/.kaggle/
! chmod 600 ~/.kaggle/kaggle.json
! ls -l ~/.kaggle
! cat ~/.kaggle/kaggle.json
1



  1