I am packaging a project that uses nltk. When you install nltk with pip, you get core functionalitiy, but not all the modules that come with it. To get those modules, you call nltk's download method.
I tried the following, but it doesn't work, saying ImportError: No module named nltk
. I assume this is happening because import nltk occurs before nltk is installed by the call to setup(...)
.
Is there a clean way of having a post-install step with distribute that executes one of the following?
$ python -m nltk.downloader punkt
>>> import nltk; nltk.download('punkt')
Here's my failed attempt at setup.py
:
class my_install(install):
def run(self):
install.run(self)
import nltk
nltk.download('punkt')
setup(
...
install_requires = [..., 'nltk==2.0.4'],
cmdclass={'install': my_install},
)