Skip to content
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

ImportError: cannot import name 'RecursiveCharacterTextSplitter' from 'langchain.text_splitter' #6

Open
dPacc opened this issue Feb 22, 2023 · 7 comments

Comments

@dPacc
Copy link

dPacc commented Feb 22, 2023

Hi there, I'm trying to run this locally, but the following error occurs when I run python ingest_data.py

@lightshifted
Copy link

I encountered a similar issue solved by:
pip install --upgrade langchain

Hopefully this works for you as well!

@akiral
Copy link

akiral commented Apr 13, 2023

Also confirm that you're running the right version of Python.

py --version

@AcerScottLee
Copy link

Also make sure that you are using the correct Python version: > > py --version.

Which of the Python versions is required? I use Python 3.8 but there will be this error, TKS

@anantdevcs
Copy link

any update on this?

@ZXXSG
Copy link

ZXXSG commented Jul 13, 2023

Hi there, I'm trying to run this locally, but the following error occurs when I run python ingest_data.py

I meet the same problem. How did you solve it in the end?

@AcerScottLee
Copy link

Hi there, I'm trying to run this locally, but the following error occurs when I run python ingest_data.py您好,我正在嘗試在本地運行它,但是當我運行 python ingest_data.py 時出現以下錯誤

I meet the same problem. How did you solve it in the end?我遇到了同樣的問題。你最後是怎麼解決的?

Have you ever tried running "pip install --upgrade langchain"?

@lsh1215
Copy link

lsh1215 commented Jul 15, 2024

Of course, it won't be helpful much later, but I found a solution. It seems to be a version issue. Currently, instead of importing from langchain.text_splitter, you should import from langchain_text_splitters.

You can install it via:
pip install -qU langchain-text-splitters

And then modify your import statement to:
from langchain_text_splitters import RecursiveCharacterTextSplitter

Try this and see if it resolves the issue.

https://python.langchain.com/v0.1/docs/modules/data_connection/document_transformers/recursive_text_splitter/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants