Kaggle API issue "Could not find kaggle.json. Make sure it's located in......"
Asked Answered
S

2

9

I am trying to use the Kaggle API to extract data from the kaggle website. I am using Ubuntu 18.04. When I enter the following command:

kaggle competitions download -c home-credit-default-risk

I get the following error:

Traceback (most recent call last):
  File "/home/hduser/anaconda3/bin/kaggle", line 5, in <module>
    from kaggle.cli import main
  File "/home/hduser/anaconda3/lib/python3.7/site-packages/kaggle/__init__.py", line 23, in <module>
    api.authenticate()
  File "/home/hduser/anaconda3/lib/python3.7/site-packages/kaggle/api/kaggle_api_extended.py", line 149, in authenticate
    self.config_file, self.config_dir))
OSError: Could not find kaggle.json. Make sure it's located in /home/hduser/.kaggle/kaggle.json. Or use the environment method.

This is strange because I have the kaggle.json file saved in the correct directory and I have all permissions granted for it.

ls ~/.kaggle

returns:

kaggle.json

Am I missing something here?

Snowball answered 23/3, 2020 at 22:14 Comment(0)
S
3

I have solved this. For some reason the following command works and not the one posted above.

~/.local/bin/kaggle competitions download -c home-credit-default-risk
Snowball answered 27/6, 2020 at 9:30 Comment(0)
M
11

I had the same problem.

Using Google's GCP notebook and after several attempts, I managed to resolve it as follows:

Generate the API file (JSON) through the Kaggle platform.

Execute: https://adityashrm21.github.io/Setting-Up-Kaggle/

Mouflon answered 21/8, 2020 at 15:17 Comment(1)
This answer and the attached link answered the problem for me to setup Kaggle on my ubuntu machine. The selected answer above occurs because the kaggle folder is not linked to usr/bin/.kaggle.Gilkey
S
3

I have solved this. For some reason the following command works and not the one posted above.

~/.local/bin/kaggle competitions download -c home-credit-default-risk
Snowball answered 27/6, 2020 at 9:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.