unstructured icon indicating copy to clipboard operation
unstructured copied to clipboard

cannot import name 'is_temp_file_path' from 'unstructured.utils' (/usr/local/lib/python3.10/dist-packages/unstructured/utils.py)

Open regismvargas opened this issue 1 year ago • 2 comments

This is my installation block:

%pip install -q --upgrade "unstructured[all-docs]" unstructured-client watermark langchain-groq langchain fastembed qdrant_client python-dotenv

This is my importing block:

# Warning control
import warnings
warnings.filterwarnings('ignore')
##
from unstructured_client import UnstructuredClient
from unstructured_client.models import shared
from unstructured_client.models.errors import SDKError

from unstructured.chunking.title import chunk_by_title

from unstructured.partition.md import partition_md
from unstructured.partition.pdf import partition_pdf
from unstructured.staging.base import dict_to_elements

Describe the bug I have received this error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
[<ipython-input-35-fe6b98299b17>](https://localhost:8080/#) in <cell line: 10>()
      8 
      9 from unstructured.chunking.title import chunk_by_title
---> 10 from unstructured.partition.md import partition_md
     11 from unstructured.partition.pptx import partition_pptx
     12 from unstructured.partition.pdf import partition_pdf

2 frames
[/usr/local/lib/python3.10/dist-packages/unstructured/partition/html/partition.py](https://localhost:8080/#) in <module>
     18 from unstructured.partition.html.parser import Flow, html_parser
     19 from unstructured.partition.lang import apply_lang_metadata
---> 20 from unstructured.utils import is_temp_file_path, lazyproperty
     21 
     22 

ImportError: cannot import name 'is_temp_file_path' from 'unstructured.utils' (/usr/local/lib/python3.10/dist-packages/unstructured/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.
---------------------------------------------------------------------------

Environment Info I am running python 3 in google colab.

regismvargas avatar Aug 29 '24 17:08 regismvargas

@regismvargas - Could you confirm what version of unstructured you're using? I see that function in the utils module.

https://github.com/Unstructured-IO/unstructured/blob/ddb6cb631db704fe4583a42a276547beee986e91/unstructured/utils.py#L63-L69

MthwRobinson avatar Aug 29 '24 20:08 MthwRobinson

Hi @MthwRobinson. Tks for reply.

This is my versions from pip

%pip list | grep unstructured
unstructured                     0.15.8
unstructured-client              0.25.5
unstructured-inference           0.7.36
unstructured.pytesseract         0.3.13

And modules versions

%watermark --iversions
unstructured : 0.15.8

regismvargas avatar Aug 30 '24 12:08 regismvargas

Closing as inactive, assumed resolved as cannot reproduce.

scanny avatar Dec 16 '24 18:12 scanny