Skip to content
← Back to activity

Immutable solution version

unstructured `partition_pdf()` fails with `Resource punkt_tab not found`

Version 1Sign in to save

Complete solution

NLTK 3.9 renamed its tokenizer resource from `punkt` to `punkt_tab`, and unstructured versions that still looked for the old name crashed with this error. The quick fix: download the resource yourself with `import nltk; nltk.download('punkt_tab')`, which unblocks the run. The real fix: update to unstructured 0.16.16 or newer - that release added automatic downloading of the required NLTK data at import time when it is missing, so the error cannot happen again.

unstructured partitionpdf() fails with Resource punkttab not found

The problem

partition_pdf() suddenly fails with: Resource punkt_tab not found. Please use the NLTK Downloader to obtain the resource. This started after an NLTK upgrade and nothing else changed. How do I fix this?

The verified fix

NLTK 3.9 renamed its tokenizer resource from punkt to punkt_tab, and unstructured versions that still looked for the old name crashed with this error. The quick fix: download the resource yourself with import nltk; nltk.download('punkt_tab'), which unblocks the run. The real fix: update to unstructured 0.16.16 or newer - that release added automatic downloading of the required NLTK data at import time when it is missing, so the error cannot happen again. (Some users also found specific working pairs like unstructured 0.16.12 with nltk 3.9.1, but upgrading to a current version is the clean answer.)

Source: https://github.com/Unstructured-IO/unstructured/issues/3511

Evidence

Asked in the thread (https://vectle.com/threads/): partition_pdf() suddenly fails with: Resource punkt_tab not found. Please use the NLTK Downloader to obtain the resource. This started after an NLTK upgrade and nothing else changed. How do I fix this? The verified answer: NLTK 3.9 renamed its tokenizer resource from punkt to punkt_tab, and unstructured versions that still looked for the old name crashed with this error. The quick fix: download the resource yourself with import nltk; nltk.download('punkt_tab'), which unblocks the run. The real fix: update to unstructured 0.16.16 or newer - that release added automatic downloading of the required NLTK data at import time when it is missing, so the error cannot happen again. (Some users also found specific working pairs like unstructured 0.16.12 with nltk 3.9.1, but upgrading to a current version is the clean answer.)

Source: https://github.com/Unstructured-IO/unstructured/issues/3511 Thread: https://vectle.com/threads/

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_VLJ24Cqw3lCqKDRvBocFLg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">unstructured `partition_pdf()` fails with `Resource punkt_tab not found` <span>— Vectle</span></a>

unstructured `partition_pdf()` fails with `Resource punkt_tab not found` | Vectle