Search code examples
google-cloud-platformgoogle-colaboratorykaggle

How to set up kaggle api in colab


I am uploading the kaggle.json file for every new session in Google Colab. Is there any way to permanently configure it using Google Drive.


Solution

  • You can save kaggle.json in gdrive, mount it, then download from there.

    You can also embed kaggle.json directly in Colab.

    !mkdir ~/.kaggle
    !echo '{"username":"korakot","key":"xxxxxxxxxxxxxxxx"}' > ~/.kaggle/kaggle.json
    !chmod 600 ~/.kaggle/kaggle.json
    

    If your notebook is private(not shared), this is the most convenient way.