-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent pydantic versions breaking with LangChain/LiteLLM/OpenAI #436
Comments
Just come across this issue again on SM Distribution v1.9 with a different tool: AWSLabs' agent-evaluation.
In this case ...But running from pydantic import BaseModel
class Test(BaseModel, validate_assignment=True):
name: str
steps: list[str] The resulting error message (with this test class or whenever I try to use agent-evaluation on SageMaker) is:
...Because Pydantic v2.8 introduced support for FailFast validation and the installed pydantic-core version is not compatible. Please can somebody help us understand why these inconsistent versions are showing up in the SM Distribution container and how to properly install software to avoid these issues? For now, I'm working around by explicitly re-installing |
Hi @athewsey, Thanks for reporting the issue! SageMaker Distribution images use micromamba to resolve dependencies. In the image v1.8 or v1.9, we have other packages (in this case, When you try to install Please let me know if you have more questions, thanks! |
For the |
I have faced the same issue with latest SageMaker distribution (1.9) when simply trying to pip install openai and import it in my notebook Error:
Workaround: On the terminal.
Would be curious to know the correct / recommended way to install openai library on sagemaker studio space. Thanks! |
Category
Compatibility Issue
🐛 Describe the bug
I ran in to the issue described here today where trying to use
litellm>=1.35.8,<2
on SageMaker Studio Distribution v1.8 fails with:Weirdly, I get different results in SageMaker for
%pip show pydantic
(v1.10.14) versus%conda list pydantic
(v2.7.0).Sure enough, trying to
import pydantic.generics
from a notebook fails with the above-mentioned error - including the Pydantic source location under/opt/conda
.From the stack trace it must be picking up v2.7.0 (Compare pydantic/generics.py @ 2.7.0 vs pydantic/generics.py @ 1.10.14) - but
version.version_short
should actually exist @ 2.7.0....And if I run the following from the same notebook:
...It reports
'1.10.14'
!If I
%pip install pydantic==1.10.14
, pip detects that the version is installed so there's nothing to do. If I restart the kernel, I get the same (reporting 1.10.14, erroring on import) behaviour as above....But if I run
%pip install --force-reinstall pydantic==1.10.14
and restart the kernel, the ImportError gets resolved.Can you guess what happens if I
%pip install pydantic==2.7.0
and restart the kernel?Well
pydantic.__version__ == '2.7.0'
... but,import pydantic.generics
works just fine! 😭 This is true even on a fresh container where I hadn't run the force-reinstall of 1.10.14.I even tried
%conda install pydantic==2.7.0 --force-reinstall
, but it just spins forever and then fails withPackagesNotFoundError: The following packages are not available from current channels
for a looooong list of packages.Based on all this - particularly the fact that installing either 1.10.14 or 2.7.0 seems to work - it really seems like something is wrong with the pydantic installation in SM Distribution: Maybe the two versions got installed on top of each other in the same location somehow and have conflicting files?
🐛 Describe the expected behavior
It'd be really useful if there was be exactly one version of pydantic visible to the Python 3 kernel, with installation mechanics that made some sense, and ideally if it's a version that correctly supports
import pydantic.generics
so that LangChain/LiteLLM/OpenAI libraries can work properly. 😅It could just be that I'm missing something about how conda & pip are meant to work together in this environment? In which case would love to learn how to deal with it properly or if it could be documented somewhere easy to find!
Image Tags
SageMaker Studio Distribution v1.8 (2024-06-11)
The text was updated successfully, but these errors were encountered: