安装使用LangChain时的报错解决

刚刚装了LangChain但是引入各种包都报错,原因貌似为 Python3.7 不支持 LangChain,需要开启一个新的Python3.10环境,再重新安装即可正常运行。

创建新的python环境

conda create -n new_env python==3.10

重新安装

pip install langchain

这是当时的报错信息,写出来希望小伙伴来避避坑

 File "E:\ProgramData\miniconda3\envs\common\lib\site-packages\langchain\__init__.py", line 8, in <module>
   from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
 File "E:\ProgramData\miniconda3\envs\common\lib\site-packages\langchain\agents\__init__.py", line 2, in <module>
   from langchain.agents.agent import Agent
 File "E:\ProgramData\miniconda3\envs\common\lib\site-packages\langchain\agents\agent.py", line 10, in <module>
   from langchain.chains.base import Chain
 File "E:\ProgramData\miniconda3\envs\common\lib\site-packages\langchain\chains\__init__.py", line 2, in <module>
   from langchain.chains.conversation.base import ConversationChain
 File "E:\ProgramData\miniconda3\envs\common\lib\site-packages\langchain\chains\conversation\base.py", line 7, in <module>
   from langchain.chains.conversation.memory import ConversationBufferMemory
 File "E:\ProgramData\miniconda3\envs\common\lib\site-packages\langchain\chains\conversation\memory.py", line 7, in <module>
   from langchain.chains.conversation.prompt import SUMMARY_PROMPT
 File "E:\ProgramData\miniconda3\envs\common\lib\site-packages\langchain\chains\conversation\prompt.py", line 2, in <module>
   from langchain.prompts.prompt import PromptTemplate
 File "E:\ProgramData\miniconda3\envs\common\lib\site-packages\langchain\prompts\__init__.py", line 2, in <module>
   from langchain.prompts.base import BasePromptTemplate
 File "E:\ProgramData\miniconda3\envs\common\lib\site-packages\langchain\prompts\base.py", line 35, in <module>
   class BasePromptTemplate(BaseModel, ABC):
 File "E:\ProgramData\miniconda3\envs\common\lib\site-packages\langchain\prompts\base.py", line 41, in BasePromptTemplate
   @root_validator()
 File "E:\ProgramData\miniconda3\envs\common\lib\site-packages\pydantic\deprecated\class_validators.py", line 231, in root_validator
   code='root-validator-pre-skip',
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.0.3/u/root-validator-pre-skip

Process finished with exit code 1
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Gaolw1102

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值