langchain-tutorials icon indicating copy to clipboard operation
langchain-tutorials copied to clipboard

'UnstructuredPDFLoader' is not defined

Open netingweb opened this issue 1 year ago • 3 comments

Hallo If I try to execute the tutorial either on colab or local I always get the following error NameError: name 'UnstructuredPDFLoader' is not defined even if I install all packages as shown on https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/unstructured_file.html

netingweb avatar Mar 20 '23 17:03 netingweb

Hello! Can you paste in your error message to chat gpt and see what it says?

If it’s undefined then it can’t find that package and you might be referencing the wrong path

On Mon, Mar 20, 2023 at 10:26 AM Neting S.r.l @.***> wrote:

Hallo If I try to execute the tutorial either on colab or local I always get the following error NameError: name 'UnstructuredPDFLoader' is not defined even if I install all packages as shown on https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/unstructured_file.html

— Reply to this email directly, view it on GitHub https://github.com/gkamradt/langchain-tutorials/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACK22PLGIYHQRVQYCJBFU6LW5CHLPANCNFSM6AAAAAAWBMPLC4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Greg Kamradt /in/gregkamradt https://www.linkedin.com/in/gregkamradt

gkamradt avatar Mar 20 '23 17:03 gkamradt

Thank you Greg for your prompt reply! I've fixed after reinstalling the following packages on my machine.

!brew install poppler !brew install tesseract

Now is it working Cheers

netingweb avatar Mar 20 '23 17:03 netingweb

Just a comment for those that cant install proppeler I actually had same issue and the above instllation don't work.

I installed pip install unstructured

and it helped


ModuleNotFoundError Traceback (most recent call last) File [.venv/Lib/site-packages/langchain/document_loaders/url.py:14), in UnstructuredURLLoader.init(self, urls) 13 try: ---> 14 import unstructured # noqa:F401 15 except ImportError:

ModuleNotFoundError: No module named 'unstructured'

kubasiak avatar Apr 05 '23 11:04 kubasiak

Unstructured is tough to get going for some users.

Just updated the code with another loader https://github.com/gkamradt/langchain-tutorials/blob/main/data_generation/Ask%20A%20Book%20Questions.ipynb

gkamradt avatar May 10 '23 18:05 gkamradt