{
  "id": 596407,
  "title": "Handling “Unable to decompress ‘JPEG Lossless…’” errors in pydicom for MRI T2 files",
  "url": "/competitions/rsna-intracranial-aneurysm-detection/discussion/596407",
  "author_name": "Akima",
  "post_date": "2025-08-03T14:33:31.845000",
  "votes": 10,
  "comment_count": 2,
  "views": 0,
  "content": "<p>I ran into an error when trying to load some \"MRI T2\" dcm files with pydicom:</p>\n<pre><code>Unable  decompress  pixel  because  plugins are missing dependencies:\n    gdcm - requires gdcm&gt;=\n    pylibjpeg - requires pylibjpeg&gt;=  pylibjpeg&gt;=\n</code></pre>\n<p><strong>Example files that show this error:</strong></p>\n<ul>\n<li><p><code>1.2.826.0.1.3680043.8.498.75712554178574230484227682423862727306/1.2.826.0.1.3680043.8.498.17519922285427694202954072250089631899.dcm</code></p></li>\n<li><p><code>1.2.826.0.1.3680043.8.498.82768897201281605198635077495114055892/1.2.826.0.1.3680043.8.498.68945582683437992452043163207501090698.dcm</code></p></li>\n<li><p><code>1.2.826.0.1.3680043.8.498.75712554178574230484227682423862727306/1.2.826.0.1.3680043.8.498.56324012072130108236035213375057123654.dcm</code></p></li>\n</ul>\n<p><strong>What I tried (and confirmed works)</strong></p>\n<p>After adding the pylibjpeg and downgrading NumPy to the 1.x series, the files load without errors:</p>\n<pre><code>\n!pip install --upgrade \n    pylibjpeg \n    pylibjpeg-libjpeg \n    pylibjpeg-openjpeg \n    imagecodecs\n\n\n!pip install --upgrade \n</code></pre>\n<p><a href=\"https://www.kaggle.com/code/tanakatentyo/rsna2025-unable-to-decompress-demo?scriptVersionId=253985604\" target=\"_blank\">sample notebook</a></p>\n<p><strong>⚠️ Feedback welcome!</strong><br>\n Downgrading NumPy to the 1.x series may introduce compatibility issues with other libraries. I'd like to hear any feedbacks or alternative solutions.</p>",
  "messages": [
    {
      "id": 3262387,
      "postDate": "2025-08-03T14:33:31.847Z",
      "content": "<p>I ran into an error when trying to load some \"MRI T2\" dcm files with pydicom:</p>\n<pre><code>Unable  decompress  pixel  because  plugins are missing dependencies:\n    gdcm - requires gdcm&gt;=\n    pylibjpeg - requires pylibjpeg&gt;=  pylibjpeg&gt;=\n</code></pre>\n<p><strong>Example files that show this error:</strong></p>\n<ul>\n<li><p><code>1.2.826.0.1.3680043.8.498.75712554178574230484227682423862727306/1.2.826.0.1.3680043.8.498.17519922285427694202954072250089631899.dcm</code></p></li>\n<li><p><code>1.2.826.0.1.3680043.8.498.82768897201281605198635077495114055892/1.2.826.0.1.3680043.8.498.68945582683437992452043163207501090698.dcm</code></p></li>\n<li><p><code>1.2.826.0.1.3680043.8.498.75712554178574230484227682423862727306/1.2.826.0.1.3680043.8.498.56324012072130108236035213375057123654.dcm</code></p></li>\n</ul>\n<p><strong>What I tried (and confirmed works)</strong></p>\n<p>After adding the pylibjpeg and downgrading NumPy to the 1.x series, the files load without errors:</p>\n<pre><code>\n!pip install --upgrade \n    pylibjpeg \n    pylibjpeg-libjpeg \n    pylibjpeg-openjpeg \n    imagecodecs\n\n\n!pip install --upgrade \n</code></pre>\n<p><a href=\"https://www.kaggle.com/code/tanakatentyo/rsna2025-unable-to-decompress-demo?scriptVersionId=253985604\" target=\"_blank\">sample notebook</a></p>\n<p><strong>⚠️ Feedback welcome!</strong><br>\n Downgrading NumPy to the 1.x series may introduce compatibility issues with other libraries. I'd like to hear any feedbacks or alternative solutions.</p>",
      "rawMarkdown": "I ran into an error when trying to load some \"MRI T2\" dcm files with pydicom:\n\n```\nUnable to decompress 'JPEG Lossless, Non-Hierarchical, First-Order Prediction (Process 14 [Selection Value 1])' pixel data because all plugins are missing dependencies:\n    gdcm - requires gdcm>=3.0.10\n    pylibjpeg - requires pylibjpeg>=2.0 and pylibjpeg-libjpeg>=2.1\n```\n\n**Example files that show this error:**\n\n- `1.2.826.0.1.3680043.8.498.75712554178574230484227682423862727306/1.2.826.0.1.3680043.8.498.17519922285427694202954072250089631899.dcm`\n       \n- `1.2.826.0.1.3680043.8.498.82768897201281605198635077495114055892/1.2.826.0.1.3680043.8.498.68945582683437992452043163207501090698.dcm`\n        \n\n- `1.2.826.0.1.3680043.8.498.75712554178574230484227682423862727306/1.2.826.0.1.3680043.8.498.56324012072130108236035213375057123654.dcm`\n\n**What I tried (and confirmed works)**\n\nAfter adding the pylibjpeg and downgrading NumPy to the 1.x series, the files load without errors:\n```\n# Install the pylibjpeg decoders\n!pip install --upgrade \\\n    pylibjpeg \\\n    pylibjpeg-libjpeg \\\n    pylibjpeg-openjpeg \\\n    imagecodecs\n\n# Downgrade NumPy so the plugins will load\n!pip install --upgrade \"numpy<2.0\"\n```\n\n[sample notebook](https://www.kaggle.com/code/tanakatentyo/rsna2025-unable-to-decompress-demo?scriptVersionId=253985604)\n\n**⚠️ Feedback welcome!**\n Downgrading NumPy to the 1.x series may introduce compatibility issues with other libraries. I'd like to hear any feedbacks or alternative solutions.\n",
      "votes": 10
    },
    {
      "id": 3263522,
      "postDate": "2025-08-05T10:47:55.453Z",
      "content": "<p>I solved this by pip install ylibjpeg&gt;=2.0 pylibjpeg-libjpeg&gt;=2.1</p>",
      "rawMarkdown": "I solved this by pip install ylibjpeg>=2.0 pylibjpeg-libjpeg>=2.1",
      "votes": 2
    },
    {
      "id": 3264359,
      "postDate": "2025-08-06T14:18:41.887Z",
      "content": "<p>To prevent <code>numpy</code> from changing, use <code>%pip install \"pylibjpeg&gt;=2.0\" \"pylibjpeg-libjpeg&gt;=2.1\" numpy==1.26.4</code> inside the notebook at top.</p>\n<p>Or better in dependencies (Add-ons &gt; Install Dependencies), add <code>pip install \"pylibjpeg&gt;=2.0\" \"pylibjpeg-libjpeg&gt;=2.1\" numpy==1.26.4</code>.</p>\n<p>Other packages (<code>pylibjpeg-openjpeg</code> and <code>imagecodecs</code>) are optional. In current notebook environment, these are the versions selected when fixing <code>numpy</code> to 1.26.4:</p>\n<ul>\n<li>imagecodecs-2025.8.2</li>\n<li>pylibjpeg-2.0.1</li>\n<li>pylibjpeg-libjpeg-2.2.0</li>\n<li>pylibjpeg-openjpeg-2.3.0</li>\n</ul>",
      "rawMarkdown": "To prevent `numpy` from changing, use `%pip install \"pylibjpeg>=2.0\" \"pylibjpeg-libjpeg>=2.1\" numpy==1.26.4` inside the notebook at top.\n\nOr better in dependencies (Add-ons > Install Dependencies), add `pip install \"pylibjpeg>=2.0\" \"pylibjpeg-libjpeg>=2.1\" numpy==1.26.4`.\n\nOther packages (`pylibjpeg-openjpeg` and `imagecodecs`) are optional. In current notebook environment, these are the versions selected when fixing `numpy` to 1.26.4:\n- imagecodecs-2025.8.2\n- pylibjpeg-2.0.1\n- pylibjpeg-libjpeg-2.2.0\n- pylibjpeg-openjpeg-2.3.0"
    }
  ],
  "comments": [
    {
      "id": 3263522,
      "author_name": "Seeing Times",
      "author_url": "",
      "post_date": "2025-08-05T10:47:55.453000",
      "content": "<p>I solved this by pip install ylibjpeg&gt;=2.0 pylibjpeg-libjpeg&gt;=2.1</p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 3264359,
      "author_name": "coderRKJ",
      "author_url": "",
      "post_date": "2025-08-06T14:18:41.887000",
      "content": "<p>To prevent <code>numpy</code> from changing, use <code>%pip install \"pylibjpeg&gt;=2.0\" \"pylibjpeg-libjpeg&gt;=2.1\" numpy==1.26.4</code> inside the notebook at top.</p>\n<p>Or better in dependencies (Add-ons &gt; Install Dependencies), add <code>pip install \"pylibjpeg&gt;=2.0\" \"pylibjpeg-libjpeg&gt;=2.1\" numpy==1.26.4</code>.</p>\n<p>Other packages (<code>pylibjpeg-openjpeg</code> and <code>imagecodecs</code>) are optional. In current notebook environment, these are the versions selected when fixing <code>numpy</code> to 1.26.4:</p>\n<ul>\n<li>imagecodecs-2025.8.2</li>\n<li>pylibjpeg-2.0.1</li>\n<li>pylibjpeg-libjpeg-2.2.0</li>\n<li>pylibjpeg-openjpeg-2.3.0</li>\n</ul>",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "3262387": "I ran into an error when trying to load some \"MRI T2\" dcm files with pydicom:\n\n```\nUnable to decompress 'JPEG Lossless, Non-Hierarchical, First-Order Prediction (Process 14 [Selection Value 1])' pixel data because all plugins are missing dependencies:\n    gdcm - requires gdcm>=3.0.10\n    pylibjpeg - requires pylibjpeg>=2.0 and pylibjpeg-libjpeg>=2.1\n```\n\n**Example files that show this error:**\n\n- `1.2.826.0.1.3680043.8.498.75712554178574230484227682423862727306/1.2.826.0.1.3680043.8.498.17519922285427694202954072250089631899.dcm`\n       \n- `1.2.826.0.1.3680043.8.498.82768897201281605198635077495114055892/1.2.826.0.1.3680043.8.498.68945582683437992452043163207501090698.dcm`\n        \n\n- `1.2.826.0.1.3680043.8.498.75712554178574230484227682423862727306/1.2.826.0.1.3680043.8.498.56324012072130108236035213375057123654.dcm`\n\n**What I tried (and confirmed works)**\n\nAfter adding the pylibjpeg and downgrading NumPy to the 1.x series, the files load without errors:\n```\n# Install the pylibjpeg decoders\n!pip install --upgrade \\\n    pylibjpeg \\\n    pylibjpeg-libjpeg \\\n    pylibjpeg-openjpeg \\\n    imagecodecs\n\n# Downgrade NumPy so the plugins will load\n!pip install --upgrade \"numpy<2.0\"\n```\n\n[sample notebook](https://www.kaggle.com/code/tanakatentyo/rsna2025-unable-to-decompress-demo?scriptVersionId=253985604)\n\n**⚠️ Feedback welcome!**\n Downgrading NumPy to the 1.x series may introduce compatibility issues with other libraries. I'd like to hear any feedbacks or alternative solutions.\n",
    "3263522": "I solved this by pip install ylibjpeg>=2.0 pylibjpeg-libjpeg>=2.1",
    "3264359": "To prevent `numpy` from changing, use `%pip install \"pylibjpeg>=2.0\" \"pylibjpeg-libjpeg>=2.1\" numpy==1.26.4` inside the notebook at top.\n\nOr better in dependencies (Add-ons > Install Dependencies), add `pip install \"pylibjpeg>=2.0\" \"pylibjpeg-libjpeg>=2.1\" numpy==1.26.4`.\n\nOther packages (`pylibjpeg-openjpeg` and `imagecodecs`) are optional. In current notebook environment, these are the versions selected when fixing `numpy` to 1.26.4:\n- imagecodecs-2025.8.2\n- pylibjpeg-2.0.1\n- pylibjpeg-libjpeg-2.2.0\n- pylibjpeg-openjpeg-2.3.0"
  }
}