Can not import ApifyWrapper from langchain.utilities to make web scrapping

305 Views Asked by At

I can not import ApifyWrapper from langchain.utilities. I need to import it to make web scrapping from a web site for a school project.

I got this error:

**

ImportError Traceback (most recent call last) Cell In1, line 3 1 from langchain.document_loaders.base import Document 2 from langchain.indexes import VectorstoreIndexCreator ----> 3 from langchain.utilities import ApifyWrapper ImportError: cannot import name 'ApifyWrapper' from 'langchain.utilities' (C:\Users\USER2023\anaconda3\lib\site-packages\langchain\utilities_init_.py)

**

enter image description here

I have checked the Langchain documentation and found that apify.ipynb is located in the tools folder. Attached link: https://github.com/langchain-ai/langchain/blob/master/docs/extras/integrations/tools/apify.ipynb

Please suggestions to solve it.

1

There are 1 best solutions below

1
simpleApp On

latest version(0.0.251) of langchain missing this Wrapper(need to dig more on it), so you can move back to the prior version.

pip install langchain==0.0.187

this version will work and import will be successful.