Kaggle / kaggle-api

Official Kaggle API
Apache License 2.0
6.16k stars 1.08k forks source link

404 - Can't pull my kernels without versions #538

Closed oxmwh closed 3 months ago

oxmwh commented 8 months ago

How to reproduce: kaggle --version -> Kaggle API 1.6.2 kaggle kernels list -m works correctly (shows both private and public kernels) but kaggle kernels pull or kaggle kernels status on my private kernels gives: 404 - Not Found - Not found They work fine on my public kernels though. Same 404 results using python like so:

import os
from kaggle.api.kaggle_api_extended import KaggleApi

os.environ['KAGGLE_CONFIG_DIR'] = "/home/<Linux-username>/.kaggle/"
api = KaggleApi()
api.authenticate()
api.kernels_pull('username/kernel-slug')
jplotts commented 8 months ago

Hi @oxmwh - I'm not reproducing the bug with kaggle kernels pull <private>; it works for me. Similarly, I think you have a slight bug in your code, as kernels_pull requires an output path

api.kernels_pull('username/kernel-slug', 'output-dir')

With the output path, I'm able to download my private kernels.

oxmwh commented 8 months ago

Thank you so much @jplotts for your response.

I have created a notebook to reproduce the bug inside Kaggle itself.

Here is also a screenshot of the bug: 404

jplotts commented 8 months ago

Hi @oxmwh - I see the problem now. It's not that the notebooks are private, it's that they have no versions. Permanent versions are created when a notebook is pushed via the API, or they can be created in the Notebook Editor UI via the "Save Version" button. I'll reopen this issue and file a bug internally to handle this case better. As a workaround in the meantime, creating a version of your notebook should enable you to pull it via the API.

oxmwh commented 8 months ago

OMG you're totally right! You're an angel from above!

stevemessick commented 3 months ago

Looks like @lucyhe fixed this one. I created another (internal) issue for push failing to create the first version and session of a kernel. (You need both version and session to exist to push a kernel.)