Cannot import name 'version_short' from 'pydantic.version' #16985
Replies: 3 comments 3 replies
-
🤖 Hey there @liuxiaojiao! 🎉 Good to see you back. How's it going? The error message you're encountering suggests that there's an issue with the version of the Pydantic library installed in your AWS SageMaker Studio environment. LangChain and the OpenAI library may require a specific version of Pydantic to function correctly. If the installed version of Pydantic in your environment is not compatible with these libraries, it could lead to import errors like the one you're experiencing. To resolve this issue, you should check the required Pydantic version for LangChain and OpenAI, and ensure that the correct version is installed in your AWS SageMaker Studio environment. You can do this by using the pip command to check the installed version of Pydantic and to install the correct version if necessary. Here is an example of how you can check the installed version of Pydantic: !pip show pydantic And here is an example of how you can install a specific version of Pydantic: !pip install pydantic==<required_version> Replace According to the Please note that the actual code you need to run may vary depending on the specific requirements of LangChain and OpenAI, and the configuration of your AWS SageMaker Studio environment. Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
-
This is a version error. Delete the installed version and specify a new version for installation. Solution: pip uninstall pydantic
pip install pydantic==1.10.8 |
Beta Was this translation helpful? Give feedback.
-
Also came across this recently in SageMaker myself and tried to dig around: I think there's something weird going on with their installed pydantic version, as documented at aws/sagemaker-distribution#436 For me, explicitly re-installing either pydantic 1.10.14 or 2.7.0 (both of which are kinda-sorta installed already - one via pip, the other via conda) seemed to resolve the ImportError. |
Beta Was this translation helpful? Give feedback.
-
Checked other resources
Commit to Help
Example Code
Description
I'm trying to install langchain in AWS SageMaker Studio.
There is an error in from langchain_openai import OpenAI: ImportError: cannot import name 'version_short' from 'pydantic.version'
System Info
python version: 3.10.13
Beta Was this translation helpful? Give feedback.
All reactions