Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

placing json file in .kaggle/kaggle.json #15

Closed
KaushalendraKumarSingh opened this issue Mar 18, 2018 · 30 comments
Closed

placing json file in .kaggle/kaggle.json #15

KaushalendraKumarSingh opened this issue Mar 18, 2018 · 30 comments

Comments

@KaushalendraKumarSingh
Copy link

KaushalendraKumarSingh commented Mar 18, 2018

cannot find the .kaggle in the specified folder.

@KaushalendraKumarSingh KaushalendraKumarSingh changed the title placing json file in .kaggle/.kaggle.json placing json file in .kaggle/kaggle.json Mar 18, 2018
@timoboz
Copy link
Contributor

timoboz commented Mar 20, 2018

Are you using Windows or Linux?

Generally you should get this file first from our homepage www.kaggle.com -> Your Account -> Create New API token. This will download a ready-to-go JSON file to place in you [user-home]/.kaggle folder. If there is no .kaggle folder yet, please create it first.

@coffeedjimmy
Copy link

@KaushalendraKumarSingh
If you are using the Mac, then in your home folder you can use 'shift' + 'cmd' + '.' to show hidden folders. Then you might find the .kaggle folder!

@sfkiwi
Copy link

sfkiwi commented Apr 12, 2018

I'm using kaggle-api on an Amazon linux instance. I downloaded the kaggle.json from the website (using my personal computer) and then copied it to the ~/.kaggle/ directory that I created on the Amazon linux, but every time I try and run kaggle it tells me

Unauthorized: you must download an API key from https://www.kaggle.com/<username>/account
Then put kaggle.json in the folder /home/ubuntu/.kaggle

My personal computer was running MacOS. Does it have to be downloaded on the same machine that you are trying to run it on? If so, I have no way of downloading the kaggle.json from the command line.

@erick84mm
Copy link

@sfkiwi you need to copy the file itself, not the content, if you copy the content the file will lose the formatting. Try copying with (I'll give you the mac example for windows there is something similar)

mac
scp /Users///kaggle.json username@server ip address:/home//.kaggle/kaggle.json

@BhavtoshRath
Copy link

BhavtoshRath commented May 8, 2018

I created a folder .kaggle in my local drive (~), moved the json file kaggle.json into it.
But when I run !kaggle competitions list on colab, I get the message:

Unauthorized: you must download an API key from https://www.kaggle.com/<username>/account
Then put kaggle.json in the folder /content/.kaggle

Not sure why is it not reading the file. Has anyone else faced this issue?

/content/ is a bit confusing. While downloading the json file, the kaggle interface clearly says

Ensure kaggle.json is in the location ~/.kaggle/kaggle.json to use the API

@qifengzhou
Copy link

@BhavtoshRath How you solved the problem?
I have the same problem here on Ubuntu 16.04. I do have the json file in the right directory as suggested.

@sagar-m
Copy link

sagar-m commented May 23, 2018

Hi, I am using mac, and in my home directory, the system is not allowing me to add dot before the folder name "kaggle", where I can place the json file. Please help. Thanks!

@ghost
Copy link

ghost commented May 23, 2018

@sagar-m, open a terminal and run mkdir ~/.kaggle. It may not work if you try to use a GUI.

@qifengzhou, @BhavtoshRath, my best guess is that you're either running the kaggle commands as root or you put the API token in your root user's home. Any chance either of those two things is what's happening?

@qifengzhou
Copy link

qifengzhou commented May 25, 2018

@rysteboe How should I check this?

I tried 'pip uninstall kaggle', it showed me the path where kaggle was installed
'/home/qifeng/anaconda3/lib/python3.6/site-packages/kaggle/'
I pasted the API token into the folder 'kaggle.json' I created in this directory.

I tried again, its the same error message:
'''
~$ kaggle competitions list -s health
Unauthorized: you must download an API key from https://www.kaggle.com//account
Then put kaggle.json in the folder /home/qifeng/.kaggle
'''

It seems kaggle called in the terminal is not the same as it was installed. I dont have a folder in the directory '/home/qifeng'

@ghost
Copy link

ghost commented May 25, 2018

Run mkdir ~/.kaggle (full path in your case would be /home/qifeng/.kaggle). You need to create that directory - the API does not do it for you. You can place the token there. The API token doesn't go in the same location as the binary, unless there's some strange interaction with anaconda that I'm unaware of.

@qifengzhou
Copy link

@rysteboe Thank you:)
That works!

@felixpython
Copy link

felixpython commented May 29, 2018

I have installed kaggle by using pip3 install kaggle.
I have already place the kaggle.json file to ~/.kaggle.
Finally, the terminal still throws the problem:-bash: kaggle: command not found.

@minhsphuc12
Copy link

minhsphuc12 commented May 29, 2018

cd %HOMEPATH%
mk .kaggle
then copy manually json file into newly created folder

@XinSu902
Copy link

XinSu902 commented Jun 1, 2018

I am using a mac. I followed kaggle's instruction until I faced the same problem here that i cannot find the folder ".kaggle". So I created a folder(.kaggle) under my home dir("/Users/xin") and drag the kaggle.json file into that folder. Then, I type the following command: "~/.kaggle/kaggle.json" and I got "-bash: /Users/xin/.kaggle/kaggle.json: Permission denied". I am not sure if i need to type this command at all after putting kaggle.json into .kaggle folder.

Then, I tried to download data sets through kaggle API using "kaggle competitions download -c imaterialist-challenge-fashion-2018" and I got "command not found"

My goal is to download a data set from kaggle that require me to use kaggle API.
Any idea what's going on here? Thanks!

@yellajaswanth
Copy link

yellajaswanth commented Jun 3, 2018

I had the same the issue. Download the token to /Users//.kaggle directory and then make sure the token file name is kaggle.json inside the folder.

@ghost
Copy link

ghost commented Jun 8, 2018

As far as I can tell, these installation instructions are covered in the readme. If you have suggestions for improving it, please submit a PR or suggest specific changes. Thanks!

@ghost ghost closed this as completed Jun 8, 2018
@lokeshdangi
Copy link

remove the directory and create it again then move the file to it

@Conengmo
Copy link
Contributor

For users of the Winpython distribution: your .kaggle folder is located in the settings folder in your Python folder. For example: C:\WinPython-64bit-3.6.1.0Qt5\settings\.kaggle\kaggle.json

@Jaco-Julio
Copy link

Jaco-Julio commented Dec 16, 2018

I faced the same problem. I found the solution. Go to your terminal and put the code " cd ~/.kaggle ", then the terminal will take you in the directory .kaggle. So, you need to move the kaggle.json to this directory, to do this use the mv command, ex. sudo mv directory1 directory2. then, run the " chmod 600 /home/[user-name]/.kaggle/kaggle.json " command.

@LUCKMOONLIGHT
Copy link

if you are using LInux.
1.pip install kaggle
2.cd ~/.kaggle
3.homepage www.kaggle.com -> Your Account -> Create New API token
4.mv ~/Downloads/kaggle.json ./
5.chmod 600 ./kaggle.json

@Ajithvajrala23
Copy link

if you are using LInux.
1.pip install kaggle
2.cd ~/.kaggle
3.homepage www.kaggle.com -> Your Account -> Create New API token
4.mv ~/Downloads/kaggle.json ./
5.chmod 600 ./kaggle.json

It worked thanks

@zenetio
Copy link

zenetio commented Jul 1, 2019

If you are using Windows and installed kaggle via anaconda, here are the steps

  1. Go to /users//.kaggle
  2. homepage www.kaggle.com -> Your Account -> Create New API token
  3. mv /users//Downloads/kaggle.json ./
  4. activate your kaggle environment and test the kaggle commands.

@PyxAI
Copy link

PyxAI commented Jul 18, 2019

I got Could not find kaggle.json error, running a notebook on a remote linux, The file was there with the right permissions.
Eventually found a workaround by running through the jupyter terminal instead

@bharath7896
Copy link

i am using windows andi used the jsonwell recently it displayed to update api token so i deleted the old one and created new token but it is saving as kaggle(2).json and i am getting error ass unauthorzed 401 what should i do ?

@ruimmpires
Copy link

hi, using a colab notebook. I did all the above today and worked fine. Now, trying to go back to my work and I get the following error:
Traceback (most recent call last):
File "/usr/local/bin/kaggle", line 5, in
from kaggle.cli import main
File "/usr/local/lib/python2.7/dist-packages/kaggle/init.py", line 23, in
api.authenticate()
File "/usr/local/lib/python2.7/dist-packages/kaggle/api/kaggle_api_extended.py", line 146, in authenticate
self.config_file, self.config_dir))
IOError: Could not find kaggle.json. Make sure it's located in /root/.kaggle. Or use the environment method.

Why is colab running python 2.7!? I believe it is not even compatible and it is specifies in the runtime to be python3.

@shivbobde
Copy link

Ya I got the same error please any one solve @ruimmpires

@swraza
Copy link

swraza commented Feb 3, 2021

the file is present under my user\kaggle\kaggle.json but when I run kaggle commands, it says
IOError: Could not find kaggle.json. Make sure it's located in /home/ec2-user/.kaggle. Or use the environment method.

Anyhelp?

@Jollygraces
Copy link

If you are using Windows and installed kaggle via anaconda, here are the steps

  1. Go to /users//.kaggle
  2. homepage www.kaggle.com -> Your Account -> Create New API token
  3. mv /users//Downloads/kaggle.json ./
  4. activate your kaggle environment and test the kaggle commands.

@Jollygraces
Copy link

Jollygraces commented Mar 13, 2021

this worked for me on windows. Thank you

@mar-co-pol
Copy link

OSError: Could not find kaggle.json. Make sure it's located in C:\Users\User.kaggle. Or use the environment method In PyCharm, Windows 10, Python 3.8 (not works for 3.9):

pip install kaggle
www.kaggle.com -> Your Account -> Create New API token
Past file in C:\User.kaggle

You're wonderful!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests