After I installed kaggle-api through pip3 install kaggle --upgrade, I got command not found error when I type kaggle into the terminal. this article will show how to solve the command not found kaggle problem.

First upgrade kaggle-api

1
pip3 install kaggle --upgrade

Then edit your ~/.bashrc file, add this line into the file.
replace <your_computer_username> with your username.

1
export PATH=/home/<your_computer_username>/.local/bin${PATH}}

kill the terminal and open another terminal again.

To use the Kaggle API, login at https://www.kaggle.com. Then go to the ‘Account’ tab of your user profile (https://www.kaggle.com/<username>/account) and select ‘Create API Token’. This will trigger the download of kaggle.json, a file containing your API credentials.

After downloading kaggle.json:

1
2
3
cd Downloads/
cp kaggle.json /home/<your_computer_username>/.kaggle
chmod 600 ~/.kaggle/kaggle.json
1
kaggle -v

Now kaggle-api should work properly.

More info can be found on https://github.com/Kaggle/kaggle-api