-
Notifications
You must be signed in to change notification settings - Fork 16k
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
Langchain Import Issue #7509
Comments
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 🤖 AnswerI found related issues that might be helpful. I did my best to summarize the solutions, but I recommend looking at the related issues yourself. Closed IssuesImportError: cannot import name 'LLMChain' from partially initialized module 'langchain'The suggested solution is: Rename the file from Unable to import from langchain.document_loadersNo solution found. Open IssuesIssue: Can not import the Langchain modules.The suggested solution is: The user should upgrade their Python version to 3.9 and then install LangChain version ERROR-Import Langchain : TypeError: dataclass_transform() got an unexpected keyword argument 'field_specifiers'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. |
Can you run 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:
Then I've tried to upgrade to 1.10.11, but I use ChromaDB (0.3.27) which depends on version 1.9 exclusively. |
@luke-j0hnson Can you duplicate the notebook and try and run it again? |
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 |
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 |
embedchain is also facing some issue due to dependency on chroma. |
add workaround for langchain-ai/langchain#7509: fix pedantic version to 1.10.8
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 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 |
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:
The text was updated successfully, but these errors were encountered: