h2oai / h2ogpt

Private chat with local GPT with document, images, video, etc. 100% private, Apache 2.0. Supports oLLaMa, Mixtral, llama.cpp, and more. Demo: https://gpt.h2o.ai/ https://gpt-docs.h2o.ai/
http://h2o.ai
Apache License 2.0
11.45k stars 1.25k forks source link

ModuleNotFoundError: No module named 'langchain_openai.chat_models'; 'langchain_openai' is not a package #1894

Closed Vidminas closed 2 weeks ago

Vidminas commented 3 weeks ago

I installed h2ogpt locally on Windows following the guide at https://github.com/h2oai/h2ogpt/blob/main/docs/README_WINDOWS.md. Following the docs in https://github.com/h2oai/h2ogpt/blob/main/docs/README_LangChain.md, I was trying to set up a user database by running python src/make_db.py --add_if_exists=True --user_path=userdata (where userdata is a directory I created). It results in the error:

$ python src/make_db.py --add_if_exists=True --user_path=userdata
Fontconfig error: Cannot load default config file: No such file: (null)
WARNING:langchain_community.utils.user_agent:USER_AGENT environment variable not set, consider setting it to identify your requests.
Traceback (most recent call last):
  File "C:\Users\Vidminas\GitHub\h2ogpt\src\make_db.py", line 9, in <module>
    from gpt_langchain import path_to_docs, get_some_dbs_from_hf, all_db_zips, some_db_zips, create_or_update_db, \
  File "C:\Users\Vidminas\GitHub\h2ogpt\src\gpt_langchain.py", line 2076, in <module>
    from langchain_together import ChatTogether
  File "C:\dev\miniconda3\envs\h2ogpt\lib\site-packages\langchain_together\__init__.py", line 3, in <module>
    from langchain_together.chat_models import ChatTogether
  File "C:\dev\miniconda3\envs\h2ogpt\lib\site-packages\langchain_together\chat_models.py", line 18, in <module>
    from langchain_openai.chat_models.base import BaseChatOpenAI
ModuleNotFoundError: No module named 'langchain_openai.chat_models'; 'langchain_openai' is not a package

Digging into this, I found that it's caused by the file src/langchain_openai.py which overrides the langchain-openai package visibility. This file should be renamed to something else.