{
  "id": 591616,
  "title": "Got  \"401 Client Error\" while downloading competition dataset with kaggle cli",
  "url": "/competitions/rsna-intracranial-aneurysm-detection/discussion/591616",
  "author_name": "Seeing Times",
  "post_date": "2025-07-29T12:02:18.351000",
  "votes": 5,
  "comment_count": 8,
  "views": 0,
  "content": "<p>Hi,</p>\n<p>I'm encountering a <code>401 Client Error: Unauthorized</code> when trying to use the Kaggle CLI to download competition data: <code>kaggle competitions download -c rsna-intracranial-aneurysm-detection\n</code>The full error message is: <br>\n<code>\n401 Client Error: Unauthorized for url: https://www.kaggle.com/api/v1/competitions/data/download-all/rsna-intracranial-aneurysm-detection\n</code><br>\nHere's what I've already tried:</p>\n<p>Expired all old API tokens and generated a new one → not working</p>\n<p>Reinstalled the Kaggle CLI (pip install kaggle --upgrade) → not working</p>\n<p>Set correct permissions on kaggle.json (chmod 600 ~/.kaggle/kaggle.json) → not working</p>\n<p>Verified environment variables or ~/.kaggle/kaggle.json is correctly configured</p>\n<p>I have already accepted the competition rules, and I can manually download the files through the website without issue.</p>\n<p>Additionally, the Kaggle CLI works fine for datasets, just not for competitions.</p>\n<p>Is there anything else I can do to fix this issue?</p>\n<p>Thanks in advance for your help!</p>",
  "messages": [
    {
      "id": 3255786,
      "postDate": "2025-07-29T12:02:18.350Z",
      "content": "<p>Hi,</p>\n<p>I'm encountering a <code>401 Client Error: Unauthorized</code> when trying to use the Kaggle CLI to download competition data: <code>kaggle competitions download -c rsna-intracranial-aneurysm-detection\n</code>The full error message is: <br>\n<code>\n401 Client Error: Unauthorized for url: https://www.kaggle.com/api/v1/competitions/data/download-all/rsna-intracranial-aneurysm-detection\n</code><br>\nHere's what I've already tried:</p>\n<p>Expired all old API tokens and generated a new one → not working</p>\n<p>Reinstalled the Kaggle CLI (pip install kaggle --upgrade) → not working</p>\n<p>Set correct permissions on kaggle.json (chmod 600 ~/.kaggle/kaggle.json) → not working</p>\n<p>Verified environment variables or ~/.kaggle/kaggle.json is correctly configured</p>\n<p>I have already accepted the competition rules, and I can manually download the files through the website without issue.</p>\n<p>Additionally, the Kaggle CLI works fine for datasets, just not for competitions.</p>\n<p>Is there anything else I can do to fix this issue?</p>\n<p>Thanks in advance for your help!</p>",
      "rawMarkdown": "Hi,\n\nI'm encountering a `401 Client Error: Unauthorized` when trying to use the Kaggle CLI to download competition data: `kaggle competitions download -c rsna-intracranial-aneurysm-detection\n`The full error message is: \n`\n401 Client Error: Unauthorized for url: https://www.kaggle.com/api/v1/competitions/data/download-all/rsna-intracranial-aneurysm-detection\n`\nHere's what I've already tried:\n\nExpired all old API tokens and generated a new one → not working\n\nReinstalled the Kaggle CLI (pip install kaggle --upgrade) → not working\n\nSet correct permissions on kaggle.json (chmod 600 ~/.kaggle/kaggle.json) → not working\n\nVerified environment variables or ~/.kaggle/kaggle.json is correctly configured\n\nI have already accepted the competition rules, and I can manually download the files through the website without issue.\n\nAdditionally, the Kaggle CLI works fine for datasets, just not for competitions.\n\nIs there anything else I can do to fix this issue?\n\nThanks in advance for your help!",
      "votes": 5
    },
    {
      "id": 3257015,
      "postDate": "2025-07-29T21:57:14.550Z",
      "content": "<p>\"pip install kaggle==1.5.16\" seems to have solved my issue. Thanks to CoPilot - the data seems to be downloading now.</p>",
      "rawMarkdown": "\"pip install kaggle==1.5.16\" seems to have solved my issue. Thanks to CoPilot - the data seems to be downloading now.",
      "votes": 6,
      "replies": [
        {
          "id": 3258095,
          "postDate": "2025-07-30T05:26:25.267Z",
          "content": "<p>thx but still 401 Client Error: Unauthorized😭</p>",
          "rawMarkdown": "thx but still 401 Client Error: Unauthorized😭",
          "votes": 1
        },
        {
          "id": 3272947,
          "postDate": "2025-08-21T19:50:51.090Z",
          "content": "<p>This works :) The latest kaggle-cli version doesn't.</p>",
          "rawMarkdown": "This works :) The latest kaggle-cli version doesn't."
        },
        {
          "id": 3287865,
          "postDate": "2025-09-12T13:19:52.027Z",
          "content": "<blockquote>\n  <p>\"pip install kaggle==1.5.16\" seems to have solved my issue. Thanks to CoPilot - the data seems to be downloading now.</p>\n</blockquote>\n<p>Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!</p>",
          "rawMarkdown": "> \"pip install kaggle==1.5.16\" seems to have solved my issue. Thanks to CoPilot - the data seems to be downloading now.\n\n\nThank you!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
        }
      ]
    },
    {
      "id": 3258057,
      "postDate": "2025-07-30T02:27:15.170Z",
      "content": "<p>Thanks <a href=\"https://www.kaggle.com/vettejeep\" target=\"_blank\">@vettejeep</a> ! I was stuck and your solution worked here as well!</p>",
      "rawMarkdown": "Thanks @vettejeep ! I was stuck and your solution worked here as well!",
      "votes": 1
    },
    {
      "id": 3257011,
      "postDate": "2025-07-29T21:40:28.137Z",
      "content": "<p>I have very much the same problem - except that the Kaggle CLI just seems to freeze with no feedback - nothing happens. I can download individual files from this competition - just not the whole data set with correct path structure. I have tried the same things as the OP.</p>",
      "rawMarkdown": "I have very much the same problem - except that the Kaggle CLI just seems to freeze with no feedback - nothing happens. I can download individual files from this competition - just not the whole data set with correct path structure. I have tried the same things as the OP.",
      "votes": 1,
      "replies": [
        {
          "id": 3287874,
          "postDate": "2025-09-12T13:43:27.787Z",
          "content": "<p>Same issue here, i can't download it via cli, it just freezes after a couple of gbs</p>",
          "rawMarkdown": "Same issue here, i can't download it via cli, it just freezes after a couple of gbs"
        }
      ]
    },
    {
      "id": 3287869,
      "postDate": "2025-09-12T13:24:54.837Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 3257015,
      "author_name": "Vettejeep",
      "author_url": "",
      "post_date": "2025-07-29T21:57:14.550000",
      "content": "<p>\"pip install kaggle==1.5.16\" seems to have solved my issue. Thanks to CoPilot - the data seems to be downloading now.</p>",
      "votes": 6,
      "replies": [
        {
          "id": 3258095,
          "author_name": "Seeing Times",
          "author_url": "",
          "post_date": "2025-07-30T05:26:25.267000",
          "content": "<p>thx but still 401 Client Error: Unauthorized😭</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 3272947,
          "author_name": "ericmit25",
          "author_url": "",
          "post_date": "2025-08-21T19:50:51.090000",
          "content": "<p>This works :) The latest kaggle-cli version doesn't.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 3287865,
          "author_name": "victorasso",
          "author_url": "",
          "post_date": "2025-09-12T13:19:52.027000",
          "content": "<blockquote>\n  <p>\"pip install kaggle==1.5.16\" seems to have solved my issue. Thanks to CoPilot - the data seems to be downloading now.</p>\n</blockquote>\n<p>Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 3258057,
      "author_name": "taliscva",
      "author_url": "",
      "post_date": "2025-07-30T02:27:15.170000",
      "content": "<p>Thanks <a href=\"https://www.kaggle.com/vettejeep\" target=\"_blank\">@vettejeep</a> ! I was stuck and your solution worked here as well!</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 3257011,
      "author_name": "Vettejeep",
      "author_url": "",
      "post_date": "2025-07-29T21:40:28.137000",
      "content": "<p>I have very much the same problem - except that the Kaggle CLI just seems to freeze with no feedback - nothing happens. I can download individual files from this competition - just not the whole data set with correct path structure. I have tried the same things as the OP.</p>",
      "votes": 1,
      "replies": [
        {
          "id": 3287874,
          "author_name": "victorasso",
          "author_url": "",
          "post_date": "2025-09-12T13:43:27.787000",
          "content": "<p>Same issue here, i can't download it via cli, it just freezes after a couple of gbs</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 3287869,
      "author_name": "",
      "author_url": "",
      "post_date": "2025-09-12T13:24:54.837000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "3255786": "Hi,\n\nI'm encountering a `401 Client Error: Unauthorized` when trying to use the Kaggle CLI to download competition data: `kaggle competitions download -c rsna-intracranial-aneurysm-detection\n`The full error message is: \n`\n401 Client Error: Unauthorized for url: https://www.kaggle.com/api/v1/competitions/data/download-all/rsna-intracranial-aneurysm-detection\n`\nHere's what I've already tried:\n\nExpired all old API tokens and generated a new one → not working\n\nReinstalled the Kaggle CLI (pip install kaggle --upgrade) → not working\n\nSet correct permissions on kaggle.json (chmod 600 ~/.kaggle/kaggle.json) → not working\n\nVerified environment variables or ~/.kaggle/kaggle.json is correctly configured\n\nI have already accepted the competition rules, and I can manually download the files through the website without issue.\n\nAdditionally, the Kaggle CLI works fine for datasets, just not for competitions.\n\nIs there anything else I can do to fix this issue?\n\nThanks in advance for your help!",
    "3257015": "\"pip install kaggle==1.5.16\" seems to have solved my issue. Thanks to CoPilot - the data seems to be downloading now.",
    "3258057": "Thanks @vettejeep ! I was stuck and your solution worked here as well!",
    "3257011": "I have very much the same problem - except that the Kaggle CLI just seems to freeze with no feedback - nothing happens. I can download individual files from this competition - just not the whole data set with correct path structure. I have tried the same things as the OP.",
    "3287869": ""
  }
}