1

Hi I am getting below error when deploying python to lambda codestar

Could somebody help me?

[Container] 2019/07/11 21:15:54 Running command . venv/bin/activate 

[Container] 2019/07/11 21:15:54 Running command python -m nltk.downloader wordnet 
/usr/local/lib/python3.7/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)) 
[nltk_data] Error loading wordnet: <urlopen error [SSL: 
[nltk_data]     CERTIFICATE_VERIFY_FAILED] certificate verify failed: 
[nltk_data]     unable to get local issuer certificate (_ssl.c:1051)> 
Error installing package. Retry? [n/y/e] 
Traceback (most recent call last): 
  File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main 
    "__main__", mod_spec) 
  File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code 
    exec(code, run_globals) 
  File "/codebuild/output/src147142456/src/venv/lib/python3.7/site-packages/nltk/downloader.py", line 2583, in <module> 
    halt_on_error=options.halt_on_error, 
  File "/codebuild/output/src147142456/src/venv/lib/python3.7/site-packages/nltk/downloader.py", line 798, in download 
    choice = input().strip() 
EOFError: EOF when reading a line
Vishnu gondlekar
  • 3,896
  • 21
  • 35
bernardo
  • 23
  • 3

1 Answers1

0

After some research I had to manually download the modules and save them into nltk_data then in my lambda, I created an environment variable $NLTK_DATA with the value ./nltk_data

Check the best answer in this post

Another thing is in the below post:

This command enables HTTPS:

python -m nltk.downloader -u https://pastebin.com/raw/D3TBY4Mj all

https://github.com/nltk/nltk/issues/1787

Michael M.
  • 10,486
  • 9
  • 18
  • 34
bernardo
  • 23
  • 3