Error while deploying my app

Traceback (most recent call last):
  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/script_runner.py", line 354, in _run_script
    exec(code, module.__dict__)
  File "/app/test/app.py", line 4, in <module>
    from langchain.text_splitter import CharacterTextSplitter
  File "/home/appuser/venv/lib/python3.9/site-packages/langchain/__init__.py", line 8, in <module>
    from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
  File "/home/appuser/venv/lib/python3.9/site-packages/langchain/agents/__init__.py", line 2, in <module>
    from langchain.agents.agent import Agent
  File "/home/appuser/venv/lib/python3.9/site-packages/langchain/agents/agent.py", line 8, in <module>
    from langchain.chains.base import Chain
  File "/home/appuser/venv/lib/python3.9/site-packages/langchain/chains/__init__.py", line 2, in <module>
    from langchain.chains.conversation.base import ConversationChain
  File "/home/appuser/venv/lib/python3.9/site-packages/langchain/chains/conversation/base.py", line 7, in <module>
    from langchain.chains.conversation.memory import ConversationBufferMemory
  File "/home/appuser/venv/lib/python3.9/site-packages/langchain/chains/conversation/memory.py", line 7, in <module>
    from langchain.chains.conversation.prompt import SUMMARY_PROMPT
  File "/home/appuser/venv/lib/python3.9/site-packages/langchain/chains/conversation/prompt.py", line 2, in <module>
    from langchain.prompts.prompt import PromptTemplate
  File "/home/appuser/venv/lib/python3.9/site-packages/langchain/prompts/__init__.py", line 2, in <module>
    from langchain.prompts.base import BasePromptTemplate
  File "/home/appuser/venv/lib/python3.9/site-packages/langchain/prompts/base.py", line 35, in <module>
    class BasePromptTemplate(BaseModel, ABC):
  File "/home/appuser/venv/lib/python3.9/site-packages/langchain/prompts/base.py", line 41, in BasePromptTemplate
    @root_validator()
  File "/home/appuser/venv/lib/python3.9/site-packages/pydantic/deprecated/class_validators.py", line 228, in root_validator
    raise PydanticUserError(
pydantic.errors.PydanticUserError: If you use `@root_validator` with pre=False (the default) you MUST specify `skip_on_failure=True`. Note that `@root_validator` is deprecated and should be replaced with `@model_validator`.

For further information visit https://errors.pydantic.dev/2.1.0/u/root-validator-pre-skip

Hi @abhijithjainn, and welcome to our forums! :raised_hands:

The error may come from the LangChain package, which is not compatible with your current Pydantic version due to a change in how Pydantic handles validation.

You can maybe try downgrading Pydantic to an earlier version, like 1.8, with pip install pydantic==1.8.

Let us know if that works! :slight_smile:

Thanks,
Charly

2 Likes

Hey thanks it worked, however i am facing another issue now.

ModuleNotFoundError: No module named ‘langchain.chains.question_answering’

I had this locally aswell, but then i uninstalled & reinstalled langchain & it worked. How to fix it here?

Is it working locally?

Yes it is working on my local host!

Potentially worth downgrading to an earlier version of Langchain, see if that solves the issue?

Thanks,
Charly

I tried downgrading, but it seems to be not working :frowning:

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.