Find answers from the community

Updated 3 months ago

nltk error llama index legacy

LookupError:
**
Resource stopwords not found.
Please use the NLTK Downloader to obtain the resource

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 5 from llama_index.legacy.llms import ChatMessage, MessageRole
File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/legacy/llms/init.py", line 12, in <module>
from llama_index.legacy.llms.ai21 import AI21
File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/legacy/llms/ai21.py", line 14, in <module>
from llama_index.legacy.llms.base import llm_chat_callback, llm_completion_callback
File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/legacy/llms/base.py", line 25, in <module>
from llama_index.legacy.core.query_pipeline.query_component import (
File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/legacy/core/query_pipeline/query_component.py", line 23, in <module>
from llama_index.legacy.core.response.schema import Response
File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/legacy/core/response/schema.py", line 7, in <module>
from llama_index.legacy.schema import NodeWithScore
File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/legacy/schema.py", line 17, in <module>
from llama_index.legacy.utils import SAMPLE_TEXT, truncate_text
File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/legacy/utils.py", line 89, in <module>
globals_helper = GlobalsHelper()
File "/home/adminuser/venv/lib/python3.9/site-packages/llama_index/legacy/utils.py", line 62, in init
nltk.download("stopwords", download_dir=self._nltk_data_dir)
a
W
L
8 comments
nltk error llama index legacy
Are you using legacy code?
Seems like nltk is trying to download stopwords package but it is failing.
Try downloading by yourself once.
Type python in your terminal and then
  • import nltk
  • nltk.download("stopwords")
The end of the error is also cut off πŸ‘€
as I am running the code on streamlit..i cannot do the following:

Type python in your terminal and then

import nltk
nltk.download("stopwords")
this error started coming since last updated of llamaindex
What version of llama-index are you using? What are you importing? NLTK files are bundled with the pip package
Add a reply
Sign up and join the conversation on Discord