Unstructured-IO / Unstructured-IO/unstructured
Compatibility issue between unstructured[pdf]==0.16.11 and pdfminer.six 20250327
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:
- pip install "unstructured[pdf]==0.16.11"
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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