Error installing requirements NLTK

Hi guys I attached my log below. But for context, these were the packages I was trying to import/use, and I added the nltk.download as someone suggested but I don’t think it worked… Could someone please help me with this? Thank you!

import streamlit as st
import pandas as pd
import numpy as np
import nltk
nltk.download(‘stopwords’)
from nltk.tokenize import sent_tokenize, word_tokenize
from nltk.corpus import stopwords
import regex as re
from nltk.stem.snowball import SnowballStemmer, PorterStemmer
from datasets import load_dataset
import copy
from rouge import Rouge
import random

en_stopwords = nltk.corpus.stopwords.words(‘english’)
stemmer = SnowballStemmer(“english”)

[ UTC ] Logs for emilygong-zhuying-text-summarization-demo-my-app-g8v594.streamlit.app/
────────────────────────────────────────────────────────────────────────────────────────
[22:13:48] :rocket: Starting up repository: ‘text-summarization-demo’, branch: ‘main’, main module: ‘my_app.py’
[22:13:48] :octopus: Cloning repository…
[22:13:49] :octopus: Cloning into ‘/app/text-summarization-demo’…

[22:13:49] :octopus: Cloned repository!
[22:13:49] :octopus: Pulling code changes from Github…
[22:13:50] :package: Processing dependencies…
Check if streamlit is installed

──────────────────────────────── Installing Streamlit ──────────────────────────────────

Collecting streamlit
Downloading streamlit-1.22.0-py2.py3-none-any.whl (8.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.9/8.9 MB 111.3 MB/s eta 0:00:00[2023-05-23 22:13:51.383195]
Collecting altair<5,>=3.2.0
Downloading altair-4.2.2-py3-none-any.whl (813 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 813.6/813.6 KB 290.4 MB/s eta 0:00:00[2023-05-23 22:13:51.460489]
Collecting click>=7.0
Downloading click-8.1.3-py3-none-any.whl (96 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 96.6/96.6 KB 139.7 MB/s eta 0:00:00[2023-05-23 22:13:51.510402]
Collecting toml
Downloading toml-0.10.2-py2.py3-none-any.whl (16 kB)
Collecting numpy
Downloading numpy-1.24.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.3/17.3 MB 232.5 MB/s eta 0:00:00[2023-05-23 22:13:52.027984]
Collecting watchdog
Downloading watchdog-3.0.0-py3-none-manylinux2014_x86_64.whl (82 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 82.1/82.1 KB 206.5 MB/s eta 0:00:00[2023-05-23 22:13:52.160615]
Collecting typing-extensions>=3.10.0.0
Downloading typing_extensions-4.6.0-py3-none-any.whl (30 kB)
Collecting protobuf<4,>=3.12
Downloading protobuf-3.20.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.0/1.0 MB 296.9 MB/s eta 0:00:00[2023-05-23 22:13:52.553050]
Collecting rich>=10.11.0
Downloading rich-13.3.5-py3-none-any.whl (238 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 238.7/238.7 KB 248.4 MB/s eta 0:00:00[2023-05-23 22:13:52.690925]
Collecting tenacity<9,>=8.0.0
Downloading tenacity-8.2.2-py3-none-any.whl (24 kB)
Collecting requests>=2.4
Downloading requests-2.31.0-py3-none-any.whl (62 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.6/62.6 KB 162.9 MB/s eta 0:00:00[2023-05-23 22:13:52.806180]
Collecting gitpython!=3.1.19
Downloading GitPython-3.1.31-py3-none-any.whl (184 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 184.3/184.3 KB 235.5 MB/s eta 0:00:00[2023-05-23 22:13:52.876848]
Collecting blinker>=1.0.0
Downloading blinker-1.6.2-py3-none-any.whl (13 kB)
Collecting tzlocal>=1.1
Downloading tzlocal-5.0.1-py3-none-any.whl (20 kB)
Collecting packaging>=14.1
Downloading packaging-23.1-py3-none-any.whl (48 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 KB 207.8 MB/s eta 0:00:00[2023-05-23 22:13:52.999890]
Collecting pillow>=6.2.0
Downloading Pillow-9.5.0-cp39-cp39-manylinux_2_28_x86_64.whl (3.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.4/3.4 MB 271.1 MB/s eta 0:00:00[2023-05-23 22:13:53.397927]
Collecting pydeck>=0.1.dev5
Downloading pydeck-0.8.1b0-py2.py3-none-any.whl (4.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.8/4.8 MB 287.6 MB/s eta 0:00:00[2023-05-23 22:13:53.466385]
Collecting pyarrow>=4.0
Downloading pyarrow-12.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (39.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 39.0/39.0 MB 231.3 MB/s eta 0:00:00[2023-05-23 22:13:53.798902]
Collecting python-dateutil
Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.7/247.7 KB 256.9 MB/s eta 0:00:00[2023-05-23 22:13:53.880118]
Collecting cachetools>=4.0
Downloading cachetools-5.3.0-py3-none-any.whl (9.3 kB)
Collecting importlib-metadata>=1.4
Downloading importlib_metadata-6.6.0-py3-none-any.whl (22 kB)
Collecting validators>=0.2
Downloading validators-0.20.0.tar.gz (30 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status ‘done’
Collecting tornado>=6.0.3
Downloading tornado-6.3.2-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (426 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 426.9/426.9 KB 266.4 MB/s eta 0:00:00[2023-05-23 22:13:54.439427]
Collecting pympler>=0.9
Downloading Pympler-1.0.1-py3-none-any.whl (164 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 164.8/164.8 KB 249.1 MB/s eta 0:00:00[2023-05-23 22:13:54.475479]
Collecting pandas<3,>=0.25
Downloading pandas-2.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.4/12.4 MB 174.2 MB/s eta 0:00:00[2023-05-23 22:13:54.808085]
Collecting entrypoints
Downloading entrypoints-0.4-py3-none-any.whl (5.3 kB)
Collecting jinja2
Downloading Jinja2-3.1.2-py3-none-any.whl (133 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.1/133.1 KB 262.5 MB/s eta 0:00:00[2023-05-23 22:13:54.916601]
Collecting toolz
Downloading toolz-0.12.0-py3-none-any.whl (55 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 55.8/55.8 KB 218.8 MB/s eta 0:00:00[2023-05-23 22:13:54.949894]
Collecting jsonschema>=3.0
Downloading jsonschema-4.17.3-py3-none-any.whl (90 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 90.4/90.4 KB 191.5 MB/s eta 0:00:00[2023-05-23 22:13:55.024208]
Collecting gitdb<5,>=4.0.1
Downloading gitdb-4.0.10-py3-none-any.whl (62 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.7/62.7 KB 219.6 MB/s eta 0:00:00[2023-05-23 22:13:55.069112]
Collecting zipp>=0.5
Downloading zipp-3.15.0-py3-none-any.whl (6.8 kB)
Collecting pytz>=2020.1
Downloading pytz-2023.3-py2.py3-none-any.whl (502 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 502.3/502.3 KB 256.3 MB/s eta 0:00:00[2023-05-23 22:13:55.320679]
Collecting tzdata>=2022.1
Downloading tzdata-2023.3-py2.py3-none-any.whl (341 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 341.8/341.8 KB 260.2 MB/s eta 0:00:00[2023-05-23 22:13:55.384250]
Collecting six>=1.5
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting urllib3<3,>=1.21.1
Downloading urllib3-2.0.2-py3-none-any.whl (123 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 123.2/123.2 KB 224.8 MB/s eta 0:00:00[2023-05-23 22:13:55.583223]
Collecting idna<4,>=2.5
Downloading idna-3.4-py3-none-any.whl (61 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.5/61.5 KB 204.9 MB/s eta 0:00:00[2023-05-23 22:13:55.653053]
Collecting certifi>=2017.4.17
Downloading certifi-2023.5.7-py3-none-any.whl (156 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 157.0/157.0 KB 254.2 MB/s eta 0:00:00[2023-05-23 22:13:55.703134]
Collecting charset-normalizer<4,>=2
Downloading charset_normalizer-3.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (199 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 199.2/199.2 KB 247.8 MB/s eta 0:00:00[2023-05-23 22:13:55.827437]
Collecting markdown-it-py<3.0.0,>=2.2.0
Downloading markdown_it_py-2.2.0-py3-none-any.whl (84 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 84.5/84.5 KB 145.6 MB/s eta 0:00:00[2023-05-23 22:13:55.891023]
Collecting pygments<3.0.0,>=2.13.0
Downloading Pygments-2.15.1-py3-none-any.whl (1.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 302.4 MB/s eta 0:00:00[2023-05-23 22:13:55.956337]
Collecting decorator>=3.4.0
Downloading decorator-5.1.1-py3-none-any.whl (9.1 kB)
Collecting smmap<6,>=3.0.1
Downloading smmap-5.0.0-py3-none-any.whl (24 kB)
Collecting MarkupSafe>=2.0
Downloading MarkupSafe-2.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Collecting attrs>=17.4.0
Downloading attrs-23.1.0-py3-none-any.whl (61 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.2/61.2 KB 142.6 MB/s eta 0:00:00[2023-05-23 22:13:56.291141]
Collecting pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0
Downloading pyrsistent-0.19.3-py3-none-any.whl (57 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.5/57.5 KB 150.1 MB/s eta 0:00:00[2023-05-23 22:13:56.367993]
Collecting mdurl~=0.1
Downloading mdurl-0.1.2-py3-none-any.whl (10.0 kB)
Building wheels for collected packages: validators
Building wheel for validators (setup.py): started
Building wheel for validators (setup.py): finished with status ‘done’
Created wheel for validators: filename=validators-0.20.0-py3-none-any.whl size=19579 sha256=0abb7c0bd7e7a7c4755a383c9330c6f72575c44cec1c44ec08d7949b864ec435
Stored in directory: /tmp/pip-ephem-wheel-cache-tvwk0anf/wheels/2d/f0/a8/1094fca7a7e5d0d12ff56e0c64675d72aa5cc81a5fc200e849
Successfully built validators
Installing collected packages: pytz, zipp, watchdog, urllib3, tzlocal, tzdata, typing-extensions, tornado, toolz, toml, tenacity, smmap, six, pyrsistent, pympler, pygments, protobuf, pillow, packaging, numpy, mdurl, MarkupSafe, idna, entrypoints, decorator, click, charset-normalizer, certifi, cachetools, blinker, attrs, validators, requests, python-dateutil, pyarrow, markdown-it-py, jsonschema, jinja2, importlib-metadata, gitdb, rich, pydeck, pandas, gitpython, altair, streamlit
Successfully installed MarkupSafe-2.1.2 altair-4.2.2 attrs-23.1.0 blinker-1.6.2 cachetools-5.3.0 certifi-2023.5.7 charset-normalizer-3.1.0 click-8.1.3 decorator-5.1.1 entrypoints-0.4 gitdb-4.0.10 gitpython-3.1.31 idna-3.4 importlib-metadata-6.6.0 jinja2-3.1.2 jsonschema-4.17.3 markdown-it-py-2.2.0 mdurl-0.1.2 numpy-1.24.3 packaging-23.1 pandas-2.0.1 pillow-9.5.0 protobuf-3.20.3 pyarrow-12.0.0 pydeck-0.8.1b0 pygments-2.15.1 pympler-1.0.1 pyrsistent-0.19.3 python-dateutil-2.8.2 pytz-2023.3 requests-2.31.0 rich-13.3.5 six-1.16.0 smmap-5.0.0 streamlit-1.22.0 tenacity-8.2.2 toml-0.10.2 toolz-0.12.0 tornado-6.3.2 typing-extensions-4.6.0 tzdata-2023.3 tzlocal-5.0.1 urllib3-2.0.2 validators-0.20.0 watchdog-3.0.0 zipp-3.15.0
WARNING: You are using pip version 22.0.3; however, version 23.1.2 is available.
You should consider upgrading via the ‘/home/appuser/venv/bin/python -m pip install --upgrade pip’ command.

────────────────────────────────────────────────────────────────────────────────────────

[22:14:08] :package: Processed dependencies!

Collecting usage statistics. To deactivate, set browser.gatherUsageStats to False.

2023-05-23 22:14:36.638 Uncaught app exception
Traceback (most recent call last):
File “/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 565, in _run_script
exec(code, module.dict)
File “/app/text-summarization-demo/my_app.py”, line 4, in
import nltk
ModuleNotFoundError: No module named ‘nltk’
2023-05-23 22:14:43.750 Uncaught app exception
Traceback (most recent call last):
File “/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 565, in _run_script
exec(code, module.dict)
File “/app/text-summarization-demo/my_app.py”, line 4, in
import nltk
ModuleNotFoundError: No module named ‘nltk’
[22:20:41] :octopus: Pulling code changes from Github…
2023-05-23 22:20:42.517 Uncaught app exception
Traceback (most recent call last):
File “/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 565, in _run_script
exec(code, module.dict)
File “/app/text-summarization-demo/my_app.py”, line 4, in
import nltk
ModuleNotFoundError: No module named ‘nltk’
[22:20:42] :package: Processing dependencies…

──────────────────────────────────────── pip ───────────────────────────────────────────

Collecting streamlit
Downloading streamlit-1.22.0-py2.py3-none-any.whl (8.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.9/8.9 MB 111.3 MB/s eta 0:00:00[2023-05-23 22:20:43.871765]
Collecting pandas
Downloading pandas-2.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.4/12.4 MB 148.8 MB/s eta 0:00:00[2023-05-23 22:20:44.389169]
Collecting numpy
Downloading numpy-1.24.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.3/17.3 MB 232.6 MB/s eta 0:00:00[2023-05-23 22:20:44.959348]
Collecting nltk
Downloading nltk-3.8.1-py3-none-any.whl (1.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 272.1 MB/s eta 0:00:00[2023-05-23 22:20:45.033042]
Collecting regex
Downloading regex-2023.5.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (769 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 769.0/769.0 KB 155.2 MB/s eta 0:00:00[2023-05-23 22:20:46.226588]
Collecting datasets
Downloading datasets-2.12.0-py3-none-any.whl (474 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 474.6/474.6 KB 136.9 MB/s eta 0:00:00[2023-05-23 22:20:46.324596]
ERROR: Could not find a version that satisfies the requirement copy (from versions: none)
ERROR: No matching distribution found for copy
2023-05-23 22:20:46.585 Uncaught app exception
Traceback (most recent call last):
File “/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 565, in _run_script
exec(code, module.dict)
File “/app/text-summarization-demo/my_app.py”, line 4, in
import nltk
ModuleNotFoundError: No module named ‘nltk’
WARNING: You are using pip version 22.0.3; however, version 23.1.2 is available.
You should consider upgrading via the ‘/home/appuser/venv/bin/python -m pip install --upgrade pip’ command.
Checking if Streamlit is installed
Found Streamlit version 1.22.0 in the environment

────────────────────────────────────────────────────────────────────────────────────────

2023-05-23 22:20:48.808 Uncaught app exception
Traceback (most recent call last):
File “/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 565, in _run_script
exec(code, module.dict)
File “/app/text-summarization-demo/my_app.py”, line 4, in
import nltk
ModuleNotFoundError: No module named ‘nltk’
[22:20:48] :exclamation: installer returned a non-zero exit code
Stopping…
[22:22:28] :exclamation: Streamlit server consistently failed status checks
[22:22:28] :exclamation: Please fix the errors, push an update to the git repo, or reboot the app.
[22:23:32] :octopus: Pulling code changes from Github…
[22:23:33] :package: Processing dependencies…
[22:23:33] :package: Processed dependencies!
[22:23:34] :arrows_counterclockwise: Updated app!
[22:27:57] :octopus: Pulling code changes from Github…
[22:27:58] :package: Processing dependencies…
[22:27:58] :package: Processed dependencies!
[22:27:59] :arrows_counterclockwise: Updated app!
[22:28:54] :octopus: Pulling code changes from Github…
[22:28:56] :package: Processing dependencies…
[22:28:56] :package: Processed dependencies!
[22:28:57] :arrows_counterclockwise: Updated app!
[22:30:35] :octopus: Pulling code changes from Github…
[22:30:36] :package: Processing dependencies…
[22:30:36] :package: Processed dependencies!
[22:30:38] :arrows_counterclockwise: Updated app!

Hey @emilygong-zhuying,

Sorry for the delayed reply on this! It looks like your app is running successfully – did you manage to resolve this issue?

Hi Caroline! Yes, I was able to figure it out. I think it might’ve been because I was developing in a conda environement locally. After I updated the requirement.txt file with versions and adding the nltk.download line, everything worked. Thanks!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.