ModuleNotFoundError, but the module is included in requirements.txt

Hey guys,

This is my first time ever trying to deploy a project to Streamlit and I’m running into a ModuleNotFoundError. Here are the links to my app and github.

Error message:

2023-11-12 02:44:19.230 Uncaught app exception
Traceback (most recent call last):
  File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 534, in _run_script
    exec(code, module.__dict__)
  File "/mount/src/recipe_recommendation/streamlit_app.py", line 7, in <module>
    from finding_scraps import *
  File "/mount/src/recipe_recommendation/finding_scraps.py", line 2, in <module>
    import nltk
ModuleNotFoundError: No module named 'nltk'

Python version: 3.10.0
Streamlit version: 1.28.1

Some solutions I’ve tried are (with no success):
-Having a public and private repo
-Using a requirements.txt file
-Using a Pipfile
-Checking for typos
-Unpinning nltk version in requirements file
-Clearing cache and rebooting app

I don’t think I’ve done these methods wrong? or maybe it’s something within my scripts? Either way any help is appreciated!

The traceback says Python 3.9. I will trust it more.

I forked at 08911a5 and deployed. No issue importing nltk. If rebooting doesn’t work, try redeploying.

I do not know why the traceback says Python 3.9 because when I ran “python --version” in terminal it said 3.10.0. Anyways, deployment worked when I rebooted the app and made no changes to my files! Thank you for the help.

Your terminal knows nothing about what you have in streamlit cloud.

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