-
-
Notifications
You must be signed in to change notification settings - Fork 411
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
Previously working RAG pipeline stopped working - cannot import name 'can_be_positional' from 'pydantic._internal._utils' #370
Comments
What is your Pydantic version? I set mine to 2.8.2 and the error went away. # pip list | grep pydantic
pydantic 2.8.2
pydantic_core 2.20.1 Edit: If we pin the requirements, this won't happen again. These work together, didn't check chroma though. requirements: langchain==0.3.1, langchain_core==0.3.7, langchain_openai==0.2.1, langchain_qdrant==0.2.0, langchain_text_splitters==0.3.0 |
I was running version 2.10.4
Downgrading to 2.8.2 did not fix the issue for me, but the error message changed. That may give me some hints for troubleshooting. My new requirements line is:
Below is the tail of the log after forcing 2.8.2.
I'll look into that new error. Thanks for the help. |
I had that error too, it was from a mismatch in langchain module and the older pydantic version. LangChain sends a different structure than Pydantic expected. Until I find a better way to manage dependencies, these are the working versions. You'll just have to try chromadb at different versions.
|
I had this problem as well, and these suggestions did not work for me, so I investigated the code some. Since the main.py script imports and calls methods from your pipeline script, your pipeline runs in the same Python process as the main script. Main.py imports pydantic (2.7.1). Python caches imported modules so they are only processed once, and was not designed to have a module updated in the "middle of running". Therefore, after updating pydantic, importing it in the pipeline has no effect, and it is still remains on 2.7.1. You can verify this by printing the version of the module in your pipeline:
Essentially, this means that you cannot use "requirements:" from the web UI to change the version of any package that is also imported in main.py. I would recommend either setting Possible workarounds:
Possible solutions:
|
Effectively, I'm getting the same pydantic version independantly of the requirements section:
I'm already using PIPELINES_URLS for deploying the pipeline but it still fails. In the end this line of requirements fixed the issue for me:
Thanks for the guidance. |
These requirements are a real pain. If the pipelines container restarts, the start script will pull in the default version of pydantic and since there's a conflict between (langchain and pydantic), will cause an infinite loop of trying to load the dependencies over and over. It should be noted, LangChain suggests using LangGraph for these history aware retrivers now. So maybe a rewrite would help. |
What was also a pain for debugging was the lack of a proper stack trace showing where the code breaks. I was only getting a single line of error message. Same for initial setup trying to find right requirements line. Not sure if there is a better way to debug. |
Following steps worked for me: Restart the pod, this will clean up any dependency mismatch due to multiple trials. install the following versions: pip install pydantic==2.7.4 langchain==0.3.3 langchain-community==0.3.2 langchain-openai==0.2.2 langchain-core==0.3.10 langchain-text-splitters==0.3.0 |
Agreed, I also had to delete the pod (I'm hosting this on K8S) to make it work. Just changing the requirements version is not enough. |
I'm running in a docker compose. I do |
I've been successfully running a lanchain RAG pipeline since August 2024, but it stopped working a couple weeks ago, also there was no code changes. I did not notice immediately as it's not used a lot, and therefore cannot relate it to a specific open-webui, langchain, or pydantic update.
What is weird is that it runs from an interactive python shell in the same environment, but does not work when loaded from open-webui.
My repo is public and the full code for the pipeline is available here: https://github.com/marvinpac-it/ask-hr-policies-open-webui/blob/master/ask_hr_policies_pipeline.py
When I check the logs of the pipeline pod, I'm getting the following:
I tried to exec the code directly inside the pipelines pod, hoping it would help me get better debug messages, but when I do that it runs perfectly well, as can be seen in the following session:
I deployed open-webui and pipelines using the open-webui helm chart from the helm.openwebui.com repo. I'm currently running the latest version.
The pipeline is defined in the values file of the helm chart:
Any help troubleshooting this further would be really appreciated.
The text was updated successfully, but these errors were encountered: