Error when trying to submit into Kaggle from the notebook

I am getting a weird issue when trying to submit the Kaggle solution from the Jupyter notebook.

The code from the cell:

!kaggle c submit -c <competition-name> -f "submit.csv" -m <message>

The message:

401 - Unauthorized

And, the very same command works when I am invoking it from the CLI. I have token inside of ~/.kaggle/kaggle.json, as well as a couple of env variables with key and username. However, it doesn’t help.

Has anybody else seen this issue before?

Maybe try deleting the token and putting a new one in ~/.kaggle/kaggle.json ? It could help, even though your issue is definitely weird. You could also try to uninstall everything kaggle on your system (the API, the tokens, …) and then reinstall and set up everything.

Yeah, I was trying to update the token but without any luck. Though I didn’t try to reinstall the Kaggle CLI itself. The main thing is that everything works like a charm from terminal but not from the notebook :smile: