Hey there folks. First time user of Streamlit and I’m loving it. Also first time trying to deploy to Streamlit Cloud. My local seems to be working fine since it can download the nltk dataset for stopwords but I don’t think it has permission to do so in the vm.
Here’s the error:
[05:54:32] 🐍 Python dependencies were installed from /mount/src/streamlit_llamadocs_chat/requirements.txt using pip.
Check if streamlit is installed
Streamlit is already installed
[05:54:34] 📦 Processed dependencies!
[nltk_data] Downloading package stopwords to
[nltk_data] /home/appuser/nltk_data...[2024-02-15 05:54:43.125453]
[nltk_data] Unzipping corpora/stopwords.zip.
[nltk_data] Downloading package stopwords to
[nltk_data] /home/adminuser/venv/lib/python3.10/site-
[nltk_data] packages/llama_index/core/_static/nltk_cache...
2024-02-15 05:54:43.763 Uncaught app exception
Traceback (most recent call last):
File "/home/adminuser/venv/lib/python3.10/site-packages/llama_index/core/utils.py", line 60, in __init__
nltk.data.find("corpora/stopwords", paths=[self._nltk_data_dir])
File "/home/adminuser/venv/lib/python3.10/site-packages/nltk/data.py", line 583, in find
raise LookupError(resource_not_found)
LookupError:
**********************************************************************
Resource stopwords not found.
Please use the NLTK Downloader to obtain the resource:
>>> import nltk
>>> nltk.download('stopwords')
For more information see: https://www.nltk.org/data.html
Attempted to load corpora/stopwords
Searched in:
- '/home/adminuser/venv/lib/python3.10/site-packages/llama_index/core/_static/nltk_cache'
**********************************************************************
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/adminuser/venv/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script
exec(code, module.__dict__)
File "/mount/src/streamlit_llamadocs_chat/main.py", line 8, in <module>
from llama_index.core import VectorStoreIndex
File "/home/adminuser/venv/lib/python3.10/site-packages/llama_index/core/__init__.py", line 8, in <module>
from llama_index.core.base.response.schema import Response
File "/home/adminuser/venv/lib/python3.10/site-packages/llama_index/core/base/response/schema.py", line 7, in <module>
from llama_index.core.schema import NodeWithScore
File "/home/adminuser/venv/lib/python3.10/site-packages/llama_index/core/schema.py", line 14, in <module>
from llama_index.core.utils import SAMPLE_TEXT, truncate_text
File "/home/adminuser/venv/lib/python3.10/site-packages/llama_index/core/utils.py", line 89, in <module>
globals_helper = GlobalsHelper()
File "/home/adminuser/venv/lib/python3.10/site-packages/llama_index/core/utils.py", line 62, in __init__
nltk.download("stopwords", download_dir=self._nltk_data_dir)
File "/home/adminuser/venv/lib/python3.10/site-packages/nltk/downloader.py", line 777, in download
for msg in self.incr_download(info_or_id, download_dir, force):
File "/home/adminuser/venv/lib/python3.10/site-packages/nltk/downloader.py", line 642, in incr_download
yield from self._download_package(info, download_dir, force)
File "/home/adminuser/venv/lib/python3.10/site-packages/nltk/downloader.py", line 701, in _download_package
os.makedirs(os.path.join(download_dir, info.subdir))
File "/usr/local/lib/python3.10/os.py", line 225, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/home/adminuser/venv/lib/python3.10/site-packages/llama_index/core/_static/nltk_cache/corpora'
[05:54:43] ❗️
Here’s my app: https://llamadocschat.streamlit.app/
Here’s the source code: streamlit_llamadocs_chat/main.py at main · amnotme/streamlit_llamadocs_chat · GitHub
Python: 3.10
I’m using Llama_Index V0.10.3 which requires Nltk 3.8.1 so I can’t downgrade.
Any help is welcome.