Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RuntimeWarning: 'nltk.downloader' found in sys.modules after import of package 'nltk', but prior to execution of 'nltk.downloader'

I'm using docker to run an NLP system that uses nltk, languagetool etc... When I use docker-compose build --build-arg env=dev I get the warning message:

/usr/local/lib/python3.6/runpy.py:125: RuntimeWarning: 'nltk.downloader' found in sys.modules after import of package 'nltk', but prior to execution of 'nltk.downloader'; this may result in unpredictable behaviour warn(RuntimeWarning(msg))

Then when I use docker-compose up I get these errors when trying to run my system:

enter image description here

Please help me figure out how to fix this!

like image 213
NewNew Avatar asked Jan 29 '19 01:01

NewNew


1 Answers

In your Dockerfile:

RUN python -c "import nltk;nltk.download('your_library')"

After pip install nltk

like image 71
razimbres Avatar answered Nov 17 '22 19:11

razimbres