Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to install nltk data on django app on elastic beanstalk

I am using nltk_tokenize in an django app . To do the same I need to do nltk data download so that I can use it for stemming . I am deploying the django app on cloud through Elastic beanstalk .

Right now I have included

nltk.download('punkt') 

in the my views so that the required data gets downloaded . But I am getting following error

[Errno 2] No such file or directory: '/home/wsgi/nltk_data'

What is the correct way to do so?

like image 613
pankaj jha Avatar asked Mar 12 '23 15:03

pankaj jha


1 Answers

I am not sure what nltk_tokenize is really, but your app is running on Elastic Beanstalk by wsgi user. This is a user that doesn't have a home directory. You need to specify the path to somewhere that exists like /opt/python/current/app (your app's directory in Elastic beanstalk), or /tmp/ or what now would make sense.

Edit: Corrected directory after comment.

like image 76
Gustaf Avatar answered Mar 16 '23 07:03

Gustaf