ModuleNotFoundError: No module named nltk'

I’m pretty new to Streamlit but I followed the instructions to use pipreqs to create my requirements.txt file. When I deploy my app I get the following error:

I’m able to run the app locally and from what I can see, my requirements.txt file contains all the necessary modules and I have all the necessary import statements in my script.

Please help!

1 Like

I have the same problem, my app uses torch, it’s included in the requirements.txt but still the website says ‘No module named torch’

You need to remove newspaper from your requirements.txt file. Per the log file:

[client] Provisioning machine...

[client] Preparing system...

[client] Spinning up manager process...

[client] Connecting...

[manager] Starting up for owner: 'randyzwitch', repository: 'newsparser', branch: 'master', main module: ''

[manager] Cloning repository ...

[manager] Cloning into 'newsparser'...

[manager] Cloned repository!

[manager] Processing dependencies ...

Requirement already satisfied: pytz==2020.5 in /usr/local/lib/python3.7/site-packages (from -r requirements.txt (line 2)) (2020.5)

Requirement already satisfied: altair==4.1.0 in /usr/local/lib/python3.7/site-packages (from -r requirements.txt (line 4)) (4.1.0)

Requirement already satisfied: pandas==1.2.1 in /usr/local/lib/python3.7/site-packages (from -r requirements.txt (line 6)) (1.2.1)

Requirement already satisfied: streamlit==0.75.0 in /usr/local/lib/python3.7/site-packages (from -r requirements.txt (line 8)) (0.75.0)

Requirement already satisfied: protobuf==3.14.0 in /usr/local/lib/python3.7/site-packages (from -r requirements.txt (line 11)) (3.14.0)

Requirement already satisfied: toolz in /usr/local/lib/python3.7/site-packages (from altair==4.1.0->-r requirements.txt (line 4)) (0.11.1)

Requirement already satisfied: jsonschema in /usr/local/lib/python3.7/site-packages (from altair==4.1.0->-r requirements.txt (line 4)) (3.2.0)

Requirement already satisfied: jinja2 in /usr/local/lib/python3.7/site-packages (from altair==4.1.0->-r requirements.txt (line 4)) (2.11.2)

Requirement already satisfied: numpy in /usr/local/lib/python3.7/site-packages (from altair==4.1.0->-r requirements.txt (line 4)) (1.19.5)

Requirement already satisfied: entrypoints in /usr/local/lib/python3.7/site-packages (from altair==4.1.0->-r requirements.txt (line 4)) (0.3)

Collecting GoogleNews==1.5.2

  Downloading GoogleNews-1.5.2-py3-none-any.whl (6.9 kB)

Requirement already satisfied: python-dateutil in /usr/local/lib/python3.7/site-packages (from GoogleNews==1.5.2->-r requirements.txt (line 9)) (2.8.1)

Collecting matplotlib==3.3.3

  Downloading matplotlib-3.3.3-cp37-cp37m-manylinux1_x86_64.whl (11.6 MB)

Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /usr/local/lib/python3.7/site-packages (from matplotlib==3.3.3->-r requirements.txt (line 1)) (2.4.7)

Requirement already satisfied: pillow>=6.2.0 in /usr/local/lib/python3.7/site-packages (from matplotlib==3.3.3->-r requirements.txt (line 1)) (8.1.0)

Collecting newspaper==

  Downloading newspaper- (176 kB)

    ERROR: Command errored out with exit status 1:

     command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-3ccj2hgn/newspaper_7ba7e83dc93749aea7b9ea7d29f5c0d8/'"'"'; __file__='"'"'/tmp/pip-install-3ccj2hgn/newspaper_7ba7e83dc93749aea7b9ea7d29f5c0d8/'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);'"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' --no-user-cfg egg_info --egg-base /tmp/pip-pip-egg-info-s1c2rze2

         cwd: /tmp/pip-install-3ccj2hgn/newspaper_7ba7e83dc93749aea7b9ea7d29f5c0d8/

    Complete output (1 lines):

    WARNING! You are attempting to install newspaper's python2 repository on python3. PLEASE RUN `$ pip3 install newspaper3k` for python3 or `$ pip install newspaper` for python2

It should be this line here:


1 Like

Your app loads for me, so not sure if this was a temporary blip or if you’ve already solved this yourself.

As a side note, your note about “Streamlit” having an issue with resources > 1GB is slightly inaccurate…Streamlit sharing as a platform provides limited resources in the free tier. Streamlit the open-source Python project doesn’t have any limitations (besides what might be present in base Python) around resource size.


Thank you! That worked!

I was trying to access the logs via Manage App (there is usually a button on my app that leads me to the logs, but I can’t find it anymore). Can you direct me to it so I can troubleshoot these issues in the future?

I checked the website again and it seems to be working, strange.

Thanks for pointing that out, I wasn’t aware of this limitation of streamlit sharing, and on top of that I wrote Streamlit sharing and Streamlit the Python project as if it was the same thing.

Thank you, and keep up the good work! :slight_smile:

1 Like

On the bottom right of the Streamlit sharing, there is the red Streamlit icon. Clicking on that brings open the black terminal menu, which is where I copied the error message from.

1 Like