Kaggle / kaggle-api

Official Kaggle API
Apache License 2.0
6.01k stars 1.06k forks source link

Unable to download model files using kaggle API #548

Closed pranavvp16 closed 4 months ago

pranavvp16 commented 4 months ago

I'm using kaggle API to download a private model from kaggle and setup my credentials of API in the .kaggle file also tried setting it up with env variables, still downloading of model fail with error 403

You don't have permission to access resource at URL: https://www.kaggle.com/api/v1/models/username/model_name/framework/variant/1/download/config.json Please make sure you are authenticated if you are trying to access a private resource or a resource requiring consent.

m-umairali commented 4 months ago

Still looking for this solution

pranavvp16 commented 4 months ago

@m-umairali I also tried importing the model in kaggle notebook while signed in to kaggle account, but still getting the same error. Maybe you can try doing this, it didn't work for me :)

jplotts commented 4 months ago

Hi @pranavvp16 - I'm not able to reproduce this. I can try again if you share the command that you're using. One thing to note is that 403 can in some cases also mean "not found" rather than an actual permissions error. This is done by many APIs to remove the ability of malicious actors to probe the namespace.

pranavvp16 commented 4 months ago

POST failed with: {"errors":["Permission \u0027models.get\u0027 was denied"],"error":{"code":7,"details":[]},"wasSuccessful":false} I'm getting this error in kaggle notebooks event though I had added the model in data sources of the notebook through kaggle UI @jplotts

jplotts commented 4 months ago

@pranavvp16 - where are you seeing that error? It looks like it's from the Kaggle Web UI, not the API. Detailed repro steps would be useful here like:

Note that just attaching the notebook in the editor doesn't mean you can use the API from the editor to access it.

pranavvp16 commented 4 months ago

Its solved the issue was with the path of download. While creating the model I named it in the name of variant but later renamed it back to model name. But the download URL expected the older name of model which was the variant name. So I created a new model with proper paths and variant .