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 #1899

Closed ricvolpi closed 1 week ago

ricvolpi commented 1 week ago

Running python src/make_db.py --download_some=True I get the following error

Traceback (most recent call last):
  File "/home/jupyter/Desktop/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 "/home/jupyter/Desktop/h2ogpt/src/gpt_langchain.py", line 2077, in <module>
    from langchain_together import ChatTogether
  File "/home/jupyter/conda/envs/h2ogpt/lib/python3.10/site-packages/langchain_together/__init__.py", line 1, in <module>
    from langchain_together.chat_models import ChatTogether
  File "/home/jupyter/conda/envs/h2ogpt/lib/python3.10/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

the reason is the langchain_openai wrapper src/langchain_openai.py (see a similar issue here). I fixed it by renaming src/langchain_openai.py into src/langchain_openai_wrapper.py and updating related imports. Things work now, but maybe we can think about a cleaner fix for this? I wonder if the other wrappers cause other issues here and there.

OS Linux / Debian 11 Python 10.3

pseudotensor commented 1 week ago

It's already been renamed last week to langchain_openai_local.py . You must be out of date on repo. Thanks!