I_Am_Yohan
I_Am_Yohan

Reputation: 186

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

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?

Upvotes: 9

Views: 11730

Answers (2)

user11148357
user11148357

Reputation:

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/

Upvotes: 11

I_Am_Yohan
I_Am_Yohan

Reputation: 186

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

Upvotes: 3

Related Questions