Unstructured-IO / Unstructured-IO/unstructured

Compatibility issue between unstructured[pdf]==0.16.11 and pdfminer.six 20250327

Open
#3,982 4 comments 14 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
15.5k
Forks
1.3k
Avg merge
4d 2h
Merged PRs (30d)
13

Description

Description:
When installing unstructured[pdf]==0.16.11, it pulls in the latest pdfminer.six 20250327, which causes import errors.

Steps to reproduce:

  1. pip install "unstructured[pdf]==0.16.11"
  2. Run the following code:
from langchain_community.document_loaders import UnstructuredPDFLoader

doc = './IF10244.pdf'
loader = UnstructuredPDFLoader(file_path=doc,
                               strategy='hi_res',
                               extract_images_in_pdf=True,
                               infer_table_structure=True,
                               mode='elements',
                               image_output_dir_path='./figures')
data = loader.load()

Error:
ImportError: cannot import name 'PSSyntaxError' from 'pdfminer.pdfparser' (/usr/local/lib/python3.11/dist-packages/pdfminer/pdfparser.py)

The issue appears to be that unstructured is trying to import PSSyntaxError from pdfminer.pdfparser, but this class isn't available in the newest version of pdfminer.six.
Workaround:
Downgrading pdfminer.six resolves the issue:
pip install pdfminer.six==20240706

Environment:
Python version: 3.11
OS: [linux]
unstructured: 0.16.11
pdfminer.six: 20250327 (fails), 20240706 (works)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with unstructured[pdf]==0.16.11 and the UnstructuredPDFLoader entry point shown in the issue. Inspect the package dependency metadata and the pdfminer.pdfparser import, then verify that installation with a supported pdfminer.six version completes and the loader runs without ImportError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-engineering
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.