Skip to content

bug/ImportError: cannot import name 'open_filename' from 'pdfminer.utils' #3801

Closed
@Antony-M1

Description

@Antony-M1

Describe the bug
After installing the unstructured & pdfminer using below commands. I'm getting the following error

!pip install -q unstructured==0.16.8
!pip install -q pdfminer==20191125

Code

from unstructured.partition.pdf import partition_pdf
from unstructured.staging.base import elements_to_json

Error

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
[<ipython-input-44-899c36516ea4>](https://localhost:8080/#) in <cell line: 8>()
      6 from langchain.text_splitter import PythonCodeTextSplitter
      7 
----> 8 from unstructured.partition.pdf import partition_pdf
      9 from unstructured.staging.base import elements_to_json
     10 

[/usr/local/lib/python3.10/dist-packages/unstructured/partition/pdf.py](https://localhost:8080/#) in <module>
     34 )
     35 from pdfminer.pdftypes import PDFObjRef
---> 36 from pdfminer.utils import open_filename
     37 from PIL import Image as PILImage
     38 

ImportError: cannot import name 'open_filename' from 'pdfminer.utils' (/usr/local/lib/python3.10/dist-packages/pdfminer/utils.py)

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions