Reputation: 1549
I'm trying to use the kaggle API to download competition data with my terminal. When I run the following command
$ kaggle competitions download -c titanic
I get the following message
$ -bash: kaggle: command not found
I read that this has to do with the fact that kaggle is probably installed in a binary that is not on the PATH
variable. To solve my problem I tried to do the following:
$ echo $PATH
which gives
/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
So I tried to find out where kaggle was installed by running
$ pip uninstall kaggle
which returned
Uninstalling kaggle-1.3.9:
Would remove:
/Users/user/Library/Python/3.6/bin/kaggle
/Users/user/Library/Python/3.6/lib/python/site-packages/kaggle-1.3.9.dist-info/*
/Users/user/Library/Python/3.6/lib/python/site-packages/kaggle/*
Proceed (y/n)?
I tried adding each one of those binaries to the PATH
variable by doing
$ export PATH=$PATH:~/Users/user/Library/Python/3.6/lib/python/site-packages/kaggle/*
for each of them.
However, when I now run $ kaggle competitions download -c titanic
I still get the same $ -bash: kaggle: command not found
Even though $ echo $PATH
shows that the binaries are now on the PATH
variable!
Question: What can I do to solve this problem and start using the kaggle API? Furthermore, does the fact that pip doesn't install new packages in binaries that are associated with the PATH
variable mean that I've manually changed something in the past? Or do you need to add those binaries to the PATH
variable once you start using pip?
Thanks!
Upvotes: 0
Views: 1940
Reputation: 11
If you download kaggle.json from https://www.kaggle.com/[account_name]/account
pip install kaggle
rm ~/.kaggle
mkdir ~/.kaggle
cp ~/Downloads/kaggle.json ~/.kaggle
kaggle --version
Upvotes: 1
Reputation: 94912
I see kaggle
in /Users/user/Library/Python/3.6/bin/kaggle
so add /Users/user/Library/Python/3.6/bin
to $PATH
and verify kaggle
is available with which kaggle
. It it's not — reset $PATH
cacheing in the shell with hash -r
.
Upvotes: 0