NLTK with flask import error NLTK with flask import error flask flask

NLTK with flask import error


It looks like the activation of your virtualenv is causing the problem. Did you activate the virtualenv before running sudo pip install -U pyyaml nltk? If not, they were installed globally. Remember that by default, when you create a virtualenv environment, it will ignore all packages not installed directly into the environment itself (in other words, it will ignore the packages you installed globally using apt-get install). So, you have two options:

  1. Install your dependencies into your virtualenv (by activating the virtualenv then doing pip install nltk). If nltk depends on any development libraries, you will need to install those development libraries as well. Those can be installed using your package manager (apt-get).

  2. Rebuild your virtualenv, this time using the --system-site-packages option. This will allow you to use packages installed outside of the virtualenv environment.