How to import ntlk module in python on cs50 ide. It is showing something like this

~/workspace/pset6/sentiments/ $ ./smile
Traceback (most recent call last):
File "./smile", line 6, in <module>
from analyzer import Analyzer
File "/home/ubuntu/workspace/pset6/sentiments/analyzer.py", line 1, in 
import nltk
ImportError: No module named 'nltk'
~/workspace/pset6/sentiments/ $ 

what should I do?

1 Answer 1


Is it possible you skipped this step in the spec?

cd ~/workspace/pset6/sentiments/
pip3 install --user -r requirements.txt
  • what is requirements.txt ? And where is it written ?
    – Rahul
    Commented Jul 30, 2017 at 17:39
  • In the Getting Started section of the spec. http://docs.cs50.net/problems/sentiments/sentiments.html#getting-started Commented Jul 30, 2017 at 17:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .