我想在我的aws笔记本(aws上的Sagemaker)中下载kaggle软件包。 这是原始代码:
# Download the data:
api_token = {"username":"....","key":"..."}
!sudo mkdir -p /root/.kaggle
with open('/root/.kaggle/kaggle.json', 'w') as file:
json.dump(api_token, file)
!chmod 600 /root/.kaggle/kaggle.json
!kaggle competitions download -c filename -p "./"
数据非常大(30gb),因此这是快速下载数据的唯一方法。 这行给我带来麻烦的原因是:
with open('/root/.kaggle/kaggle.json', 'w') as file:
json.dump(api_token, file)
错误:
PermissionError: [Errno 13] Permission denied: '/root/.kaggle/kaggle.json'
我该怎么办?
答案 0 :(得分:0)
如果您想在 AWS Sagemaker Notebook 实例中下载 Kaggle 数据集,您可以按照以下步骤操作:
pip install kaggle
mkdir /home/ec2-user/.kaggle
mv /home/ec2-user/SageMaker/kaggle.json /home/ec2-user/.kaggle
kaggle datasets download -d name_of_the_dataset
参考:https://freddiek.github.io/2018/06/10/accessing-Kaggle-from-SageMaker-instance.html