No module named 'nltk'

Streamlit (sms-detector-amp8tzyipmnqus6lpovaqm.streamlit.app)

govindsingh3477/SMS-DETECTOR: This is the repo of the code of machine learning project which detects if a email or sms is spam or not. (github.com)

i was trying to deploy this project . But

ModuleNotFoundError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).

Traceback:

File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 589, in _run_script
    exec(code, module.__dict__)File "/mount/src/sms-detector/app.py", line 4, in <module>
    import nltk

this error occurs

Hi there,

Thanks for sharing this question! We actually have an FAQ about this topic – please check it out: FAQ: ModuleNotFoundError.

Happy Streamlit-ing! :balloon:

i added requirements.txt but new error occured

Error installing requirements.

Click “Manage App” and consult the terminal for more details.

If you still have questions, leave a message in our forums and we will get back to you ASAP.

Hey @govind,

I’m not seeing that error (see screenshot below). How can we reproduce it?

The error is resolved. Included the code

nltk.download('punkt')
nltk.download('stopwords')

included this code in my app.py

the url of app is updated to Streamlit (sms-detector-g.streamlit.app)

1 Like

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