Python Forum
Installing nltk dependency - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Installing nltk dependency (/thread-29375.html)



Installing nltk dependency - Eshwar - Aug-30-2020

I have a python package for which nltk is a dependent package i.e. part of install_requires. My package has a dependency on wordnet corpus downloaded i.e. nltk.download('wordnet'). In order to do this I was able to use cmdclass: install and setup the download. This worked well until we had a requirement to install my package into a specific target folder. What would happen is if nltk isn't present for the default location where setup is running it would fail with module not found error. I saw guidance that nltk should also be part of setup_requires. This just fails installation at the begining. So have a few questions on this,

Is there a way to force install nltk in the location for setup to pick it up in addition to the target path?
Is there a better way to handle this overall scenario. I could remove the custom install action and instead do the download from within my module at runtime. But I don't quite like that option.

Any feedback on this would be greatly appreciated. Thanks so much.