langchain: import error when importing `from langchain import OpenAI` on 0.0.151

got the following error when running today:

    from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
  File "venv/lib/python3.11/site-packages/langchain/agents/__init__.py", line 2, in <module>
    from langchain.agents.agent import (
  File "venv/lib/python3.11/site-packages/langchain/agents/agent.py", line 17, in <module>
    from langchain.chains.base import Chain
  File "venv/lib/python3.11/site-packages/langchain/chains/__init__.py", line 2, in <module>
    from langchain.chains.api.base import APIChain
  File "venv/lib/python3.11/site-packages/langchain/chains/api/base.py", line 8, in <module>
    from langchain.chains.api.prompt import API_RESPONSE_PROMPT, API_URL_PROMPT
  File "venv/lib/python3.11/site-packages/langchain/chains/api/prompt.py", line 2, in <module>
    from langchain.prompts.prompt import PromptTemplate
  File "venv/lib/python3.11/site-packages/langchain/prompts/__init__.py", line 14, in <module>
    from langchain.prompts.loading import load_prompt
  File "venv/lib/python3.11/site-packages/langchain/prompts/loading.py", line 14, in <module>
    from langchain.utilities.loading import try_load_from_hub
  File "venv/lib/python3.11/site-packages/langchain/utilities/__init__.py", line 5, in <module>
    from langchain.utilities.bash import BashProcess
  File "venv/lib/python3.11/site-packages/langchain/utilities/bash.py", line 7, in <module>
    import pexpect
ModuleNotFoundError: No module named 'pexpect'

does this need to be added to project dependencies?

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 21 (5 by maintainers)

Commits related to this issue

Most upvoted comments

Will fix. Thank you. We will improve our CI to prevent this type of error from occurring moving forward

The reason this slipped through is that it is a dependency of poetry itself. we will address this. Thanks for everyone’s patience