Closed Fulladorn closed 1 year ago
I saw 2 similar issues on Discord, Langchain was working for a few weeks and then today is presenting the above error.
I am also experiencing the above error
Answer generated by a 🤖
I found related issues that might be helpful. I did my best to summarize the solutions, but I recommend looking at the related issues yourself.
The suggested solution is: Rename the file from requests.py
to requests_chain.py
to resolve the issue.
No solution found.
The suggested solution is: The user should upgrade their Python version to 3.9 and then install LangChain version 0.0.219
. The issue seems to be due to a version mismatch in the Pydantic module.
The suggested solution is:
Create a new environment with Python version 3.9.12. Then install langchain (pip install langchain) and chromadb (pip install chromadb). This should resolve the issue.
This response is meant to be useful, save you time, and share context. 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.
@luke-j0hnson
Can you run pip uninstall -y langchain
and then reinstall and see if your issue persists? It seemed to work for me...
Edit: Worked for 1 notebook, but not the other... hmm
Didn’t solve the issue in my notebook either. Code has worked for weeks stopped working tonight with the same error
Same here, using latest Python (3.11.4) in Docker environment and Langchain 0.0.229 (latest in PyPI). Tried to upgrade Pydantic to the latest version, as suggested here, but I've got this error:
The conflict is caused by:
The user requested pydantic~=2.0.2
langchain 0.0.229 depends on pydantic<2 and >=1
Then I've tried to upgrade to 1.10.11, but I use ChromaDB (0.3.27) which depends on version 1.9 exclusively.
Also, manually installing typing-inspect
and typing_extensions
as it was also suggested in the linked StackOverflow question didn't help either.
@luke-j0hnson Can you duplicate the notebook and try and run it again?
Same here, using latest Python (3.11.4) in Docker environment and Langchain 0.0.229 (latest in PyPI). Tried to upgrade Pydantic to the latest version, as suggested here, but I've got this error:
The conflict is caused by: The user requested pydantic~=2.0.2 langchain 0.0.229 depends on pydantic<2 and >=1
Then I've tried to upgrade to 1.10.11, but I use ChromaDB which depends on version 1.9 exclusively. Also, manually installing
typing-inspect
andtyping_extensions
as it was also suggested in the linked StackOverflow question didn't help either.
Is your development environment a Jupyter Notebook?
No, it's a standard one, sorry that I forgot to mention that only difference.
I'm not sure why my duplicated notebook is working now and hasn't been changed at all...
Try using chromadb==0.3.26 There is a problem with Chroma 0.3.27 and Pydantic. https://github.com/chroma-core/chroma/issues/785
I had the same issue and I solved it installing chromadb==0.3.26 and chromadb==0.3.26 versions.
pip install pydantic==1.10.8 working
I've tried with ChromaDB 0.3.26 as suggested but that didn't work either :( Seems like Pydantic needs to be upgraded too, but ChromaDB requirement prevents it to be upgraded to the version greater than 1.9.
Update: Putting pydantic==1.10.8
after chromadb==0.3.26
in requirements.txt did the trick, thanks!
embedchain is also facing some issue due to dependency on chroma. Fixed by locking the package version in setup.py for now: https://github.com/embedchain/embedchain/commit/34fd4180ec3d05de16046ad97d3edb105bbfddf1
FWIW, following directions above of @lukafilipxvic and @softzer0, my below is working, and my three-day nightmare is over.
[tool.poetry.dependencies]
python = "^3.10"
pydantic = "1.10.8"
chromadb = "0.3.26"
#chromadb = ">=0.3.27"
#pydantic = "1.9.0"
langchain = "^0.0.231"
llama-index = "^0.7.5"
openai = "^0.27.8"
ipykernel = "^6.24.0"
python-dotenv = "^1.0.0"
believe this is same as #7548
Hi, @Fulladorn! I'm Dosu, and I'm here to help the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.
Based on my understanding, the issue you reported is related to the module langchain.document_loaders
not being importable due to a TypeError
. There have been some suggestions in the comments, such as renaming a file, upgrading Python, and installing a specific version of LangChain. Additionally, there is a discussion about conflicts with Pydantic and ChromaDB versions.
Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.
Thank you for your understanding and contribution to the LangChain project!
Please assist me for this problem
ImportError: cannot import name 'Ollama' from 'langchain.llms'
More details the problem also written in this way
"from langchain.llms import Ollama ImportError: cannot import name 'Ollama' from 'langchain.llms' (/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/langchain/llms/init.py)"
use 'langchain_community.llms' to import Ollama
from langchain_community.llms import Ollama
note that langchain is not supporting python version 3.8 below try to use 3.8+
System Info
Python 3.10.8 Langchain==0.0.229
AWS Sagemaker Studio w/ PyTorch 2.0.0 Python 3.10 GPU Optimized image
Who can help?
@hwchase17 or @agola11
Information
Related Components
Reproduction
Was working fine in a Jupyter Notebook in AWS Sagemaker Studio for the past few weeks but today running into an issue with no code changes... import chain issue?
!pip install langchain openai chromadb tiktoken pypdf unstructured pdf2image;
from langchain.document_loaders import TextLoader
Results in: