techleadhd / chatgpt-retrieval

1.65k stars 786 forks source link

ModuleNotFoundError: No module named 'langchain_community.chains' #52

Closed sn000 closed 5 months ago

sn000 commented 5 months ago

Hi,

I'm keep getting this error...

pip3 install --upgrade langchain Requirement already satisfied: langchain in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (0.1.1) Requirement already satisfied: PyYAML>=5.3 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from langchain) (6.0.1) Requirement already satisfied: SQLAlchemy<3,>=1.4 in /Library/Fra

and so on but in pycharm I'm getting errors like "Cannot find reference 'chains' in 'init.py'" and some other...

I'm bit new to python so maybe it is something oubvious???

I'm using mac with this M1 processor so maybe this is somehow issue? for example J can't install pip in Linux vm that I run on this mac.

sn000 commented 5 months ago

weird though I've paste error in message... The error is: ModuleNotFoundError: No module named 'langchain_community.chains'

andrea-everag commented 5 months ago

this works for me

pip install langchain_community
pip install langchain_openai 

new imports

from langchain.chains import ConversationalRetrievalChain, RetrievalQA
from langchain_openai import ChatOpenAI
from langchain_community.document_loaders import DirectoryLoader, TextLoader
from langchain_openai import OpenAIEmbeddings
from langchain.indexes import VectorstoreIndexCreator
from langchain.indexes.vectorstore import VectorStoreIndexWrapper
from langchain_community.llms import OpenAI
from langchain_community.vectorstores import Chroma
sn000 commented 5 months ago

Thank you @andrea-everag

this didn't help, I've tested that before posting ....

but someone advised me to use conda... I did and somehow magically this fixed my issue... but frankly I don't understand how because all packages imports looks the same as before .