How can I set up a Ray (a distributed programming framework) and Flask app on AWS Elastic Beanstalk? - python-3.x

Background
I've been trying, unsuccessfully, to implement Ray (https://github.com/ray-project/ray) into the production version of our AI API. Essentially, we want to use it to speed up one of our clustering algorithms to reduce the delays that occur with a large number of clusters. Our API is written using Python3.6, Flask, and Numpy. We use Elastic Beanstalk and bitbucket pipelines to make continuous development relatively easy. When we tried to incorporate Ray recently, though, we kept getting a series of errors. Some are build errors from EB which we fixed by deleting enum34 (something we've never had to do before) and the rest have been what appear to be mod_wsgi errors (again, something we've never encountered before). The following is a snippet of the error messages recorded on CloudWatch (it repeats after this). I just want to know what I'm doing wrong, how to fix this error that's appearing, and how to deploy this API correctly.
Stack Trace (from CloudWatch)
2020-09-15T02:27:57.571-07:00 [Tue Sep 15 09:26:06.609052 2020] [suexec:notice] [pid 3248] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
2020-09-15T02:27:57.571-07:00 [Tue Sep 15 09:26:06.623605 2020] [http2:warn] [pid 3248] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.
2020-09-15T02:27:57.571-07:00 [Tue Sep 15 09:26:06.623616 2020] [http2:warn] [pid 3248] AH02951: mod_ssl does not seem to be enabled
2020-09-15T02:27:57.571-07:00 [Tue Sep 15 09:26:06.624028 2020] [lbmethod_heartbeat:notice] [pid 3248] AH02282: No slotmem from mod_heartmonitor
2020-09-15T02:27:57.571-07:00 [Tue Sep 15 09:26:06.624068 2020] [:warn] [pid 3248] mod_wsgi: Compiled for Python/3.6.2.
2020-09-15T02:27:57.571-07:00 [Tue Sep 15 09:26:06.624072 2020] [:warn] [pid 3248] mod_wsgi: Runtime using Python/3.6.12.
2020-09-15T02:27:57.571-07:00 [Tue Sep 15 09:26:06.625952 2020] [mpm_prefork:notice] [pid 3248] AH00163: Apache/2.4.46 (Amazon) mod_wsgi/3.5 Python/3.6.12 configured -- resuming normal operations
2020-09-15T02:27:57.571-07:00 [Tue Sep 15 09:26:06.625967 2020] [core:notice] [pid 3248] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
2020-09-15T02:32:51.234-07:00 [Tue Sep 15 09:32:50.298983 2020] [mpm_prefork:notice] [pid 3248] AH00169: caught SIGTERM, shutting down
2020-09-15T02:32:52.234-07:00 [Tue Sep 15 09:32:51.353642 2020] [suexec:notice] [pid 7649] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
2020-09-15T02:32:52.234-07:00 [Tue Sep 15 09:32:51.367142 2020] [so:warn] [pid 7649] AH01574: module wsgi_module is already loaded, skipping
2020-09-15T02:32:52.234-07:00 [Tue Sep 15 09:32:51.368899 2020] [http2:warn] [pid 7649] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.
2020-09-15T02:32:52.234-07:00 [Tue Sep 15 09:32:51.368908 2020] [http2:warn] [pid 7649] AH02951: mod_ssl does not seem to be enabled
2020-09-15T02:32:52.234-07:00 [Tue Sep 15 09:32:51.369374 2020] [lbmethod_heartbeat:notice] [pid 7649] AH02282: No slotmem from mod_heartmonitor
2020-09-15T02:32:52.234-07:00 [Tue Sep 15 09:32:51.369426 2020] [:warn] [pid 7649] mod_wsgi: Compiled for Python/3.6.2.
2020-09-15T02:32:52.234-07:00 [Tue Sep 15 09:32:51.369431 2020] [:warn] [pid 7649] mod_wsgi: Runtime using Python/3.6.12.
2020-09-15T02:32:52.234-07:00 [Tue Sep 15 09:32:51.377064 2020] [mpm_prefork:notice] [pid 7649] AH00163: Apache/2.4.46 (Amazon) mod_wsgi/3.5 Python/3.6.12 configured -- resuming normal operations
2020-09-15T02:32:52.234-07:00 [Tue Sep 15 09:32:51.377085 2020] [core:notice] [pid 7649] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
2020-09-15T02:32:55.236-07:00 [Tue Sep 15 09:32:54.638019 2020] [:warn] [pid 7659] mod_wsgi (pid=7659): Callback registration for signal 15 ignored.
2020-09-15T02:32:55.236-07:00 [Tue Sep 15 09:32:54.638907 2020] [:warn] [pid 7659] File "/opt/python/current/app/run.py", line 5, in <module>
2020-09-15T02:32:55.236-07:00 [Tue Sep 15 09:32:54.638917 2020] [:warn] [pid 7659] import ray
2020-09-15T02:32:55.236-07:00 [Tue Sep 15 09:32:54.638925 2020] [:warn] [pid 7659] File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2020-09-15T02:32:55.236-07:00 [Tue Sep 15 09:32:54.638931 2020] [:warn] [pid 7659] File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
2020-09-15T02:32:55.236-07:00 [Tue Sep 15 09:32:54.638937 2020] [:warn] [pid 7659] File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
2020-09-15T02:32:55.236-07:00 [Tue Sep 15 09:32:54.638942 2020] [:warn] [pid 7659] File "<frozen importlib._bootstrap_external>", line 678, in exec_module
2020-09-15T02:32:55.236-07:00 [Tue Sep 15 09:32:54.638948 2020] [:warn] [pid 7659] File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2020-09-15T02:32:55.236-07:00 [Tue Sep 15 09:32:54.638954 2020] [:warn] [pid 7659] File "/opt/python/run/venv/local/lib/python3.6/site-packages/ray/__init__.py", line 81, in <module>
2020-09-15T02:32:55.236-07:00 [Tue Sep 15 09:32:54.638957 2020] [:warn] [pid 7659] from ray.worker import (
2020-09-15T02:32:55.236-07:00 [Tue Sep 15 09:32:54.638962 2020] [:warn] [pid 7659] File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2020-09-15T02:32:55.236-07:00 [Tue Sep 15 09:32:54.638967 2020] [:warn] [pid 7659] File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
2020-09-15T02:32:55.236-07:00 [Tue Sep 15 09:32:54.638973 2020] [:warn] [pid 7659] File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
2020-09-15T02:32:55.236-07:00 [Tue Sep 15 09:32:54.638987 2020] [:warn] [pid 7659] File "<frozen importlib._bootstrap_external>", line 678, in exec_module
2020-09-15T02:32:55.236-07:00 [Tue Sep 15 09:32:54.638992 2020] [:warn] [pid 7659] File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2020-09-15T02:32:55.236-07:00 [Tue Sep 15 09:32:54.638998 2020] [:warn] [pid 7659] File "/opt/python/run/venv/local/lib/python3.6/site-packages/ray/worker.py", line 873, in <module>
2020-09-15T02:32:55.236-07:00 [Tue Sep 15 09:32:54.639001 2020] [:warn] [pid 7659] ray.utils.set_sigterm_handler(sigterm_handler)
2020-09-15T02:32:55.236-07:00 [Tue Sep 15 09:32:54.639006 2020] [:warn] [pid 7659] File "/opt/python/run/venv/local/lib/python3.6/site-packages/ray/utils.py", line 722, in set_sigterm_handler
2020-09-15T02:32:55.236-07:00 [Tue Sep 15 09:32:54.639010 2020] [:warn] [pid 7659] signal.signal(signal.SIGTERM, sigterm_handler)
2020-09-15T02:32:55.236-07:00 [Tue Sep 15 09:32:55.203215 2020] [:error] [pid 7659] DEBUG:ray.node:Process STDOUT and STDERR is being redirected to /tmp/ray/session_2020-09-15_09-32-55_202688_7659/logs.
2020-09-15T02:32:55.236-07:00 [Tue Sep 15 09:32:55.204027 2020] [:error] [pid 7659] INFO:ray.resource_spec:Starting Ray with 4.44 GiB memory available for workers and up to 2.24 GiB for objects. You can adjust these settings with ray.init(memory=<bytes>, object_store_memory=<bytes>).
2020-09-15T02:32:56.238-07:00 [Tue Sep 15 09:32:55.309054 2020] [:error] [pid 7659] DEBUG:ray.services:Waiting for redis server at 127.0.0.1:6379 to respond...
2020-09-15T02:32:56.238-07:00 [Tue Sep 15 09:32:55.525174 2020] [:error] [pid 7659] DEBUG:ray.services:Waiting for redis server at 127.0.0.1:19594 to respond...
2020-09-15T02:32:56.238-07:00 [Tue Sep 15 09:32:55.526660 2020] [:error] [pid 7659] DEBUG:ray.services:Starting Redis shard with 0.8 GB max memory.
2020-09-15T02:32:56.238-07:00 [Tue Sep 15 09:32:55.663605 2020] [:error] [pid 7659] INFO:ray.services:View the Ray dashboard at \x1b[1m\x1b[32mlocalhost:8265\x1b[39m\x1b[22m
2020-09-15T02:32:56.238-07:00 [Tue Sep 15 09:32:55.665571 2020] [:error] [pid 7659] DEBUG:ray.node:Process STDOUT and STDERR is being redirected to /tmp/ray/session_2020-09-15_09-32-55_202688_7659/logs.
2020-09-15T02:32:56.238-07:00 [Tue Sep 15 09:32:55.666148 2020] [:error] [pid 7659] DEBUG:ray.services:Determine to start the Plasma object store with 2.41 GB memory using /dev/shm.
2020-09-15T02:32:56.238-07:00 [Tue Sep 15 09:32:55.670650 2020] [:error] [pid 7659] DEBUG:ray.services:Determine to start the Plasma object store with 2.41 GB memory using /dev/shm.
2020-09-15T02:32:56.238-07:00 [Tue Sep 15 09:32:55.696353 2020] [:error] [pid 7659] [remote 127.0.0.1:0] mod_wsgi (pid=7659): Target WSGI script '/opt/python/current/app/run.py' cannot be loaded as Python module.
2020-09-15T02:32:56.238-07:00 [Tue Sep 15 09:32:55.696417 2020] [:error] [pid 7659] [remote 127.0.0.1:0] mod_wsgi (pid=7659): Exception occurred processing WSGI script '/opt/python/current/app/run.py'.
2020-09-15T02:32:56.238-07:00 [Tue Sep 15 09:32:55.696594 2020] [:error] [pid 7659] [remote 127.0.0.1:0] Traceback (most recent call last):
2020-09-15T02:32:56.238-07:00 [Tue Sep 15 09:32:55.696630 2020] [:error] [pid 7659] [remote 127.0.0.1:0] File "/opt/python/current/app/run.py", line 24, in <module>
2020-09-15T02:32:56.238-07:00 [Tue Sep 15 09:32:55.696635 2020] [:error] [pid 7659] [remote 127.0.0.1:0] ray.init(configure_logging=False)
2020-09-15T02:32:56.238-07:00 [Tue Sep 15 09:32:55.696643 2020] [:error] [pid 7659] [remote 127.0.0.1:0] File "/opt/python/run/venv/local/lib/python3.6/site-packages/ray/worker.py", line 806, in init
2020-09-15T02:32:56.238-07:00 [Tue Sep 15 09:32:55.696648 2020] [:error] [pid 7659] [remote 127.0.0.1:0] job_id=job_id)
2020-09-15T02:32:56.238-07:00 [Tue Sep 15 09:32:55.696654 2020] [:error] [pid 7659] [remote 127.0.0.1:0] File "/opt/python/run/venv/local/lib/python3.6/site-packages/ray/worker.py", line 1178, in connect
2020-09-15T02:32:56.238-07:00 [Tue Sep 15 09:32:55.696659 2020] [:error] [pid 7659] [remote 127.0.0.1:0] faulthandler.enable(all_threads=False)
2020-09-15T02:32:56.238-07:00 [Tue Sep 15 09:32:55.696677 2020] [:error] [pid 7659] [remote 127.0.0.1:0] AttributeError: 'mod_wsgi.Log' object has no attribute 'fileno
This is our code in .ebextensions:
.ebextensions/packages.config file:
packages:
yum:
gcc-c++: []
python36-devel: []
The actual error here seems to be AttributeError: 'mod_wsgi.Log' object has no attribute 'fileno'.
.ebextensions/00_commands.config
commands:
00_setup_pip:
command: sudo python3 -m pip install --upgrade --force pip
01_uninstall_enum34:
command: pip uninstall -y enum34
.ebextensions/00_files.config
files:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/00_uninstall_enum34.sh":
mode: "000755"
owner: root
group: root
content: |
rm -f -r /opt/python/run/venv/lib/python3.6/site-packages/enum && rm -f -r /opt/python/run/venv/lib/python3.6/site-packages/enum34-1.1.10.dist-info
run.py
For the Flask app, our run file is written as follows:
#!/usr/bin/env python3
import atexit
import importlib
import logging
import ray
import threading
import settings
import src.routes as routes
from src import app as application
# Commented out because we can't even get the single machine instance working. Forget clusters.
# if settings.ENVIRONMENT == 'PRODUCTION':
# try:
# ray.init(address='auto')
# except Exception:
# ray.init()
# else:
# try:
# ray.init()
# except Exception as error:
# raise error
ray.init(configure_logging=False)
# Import and register routes with Flask application
# importlib.import_module('.routes', 'src')
if settings.REPEAT:
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)
if __name__ == '__main__':
# If this service is designated as the repeat service this function will be called every hour.
application.run('0.0.0.0', port=settings.PORT, debug=True, threaded=settings.THREADED)
We used to also have container_commands to start the Ray cluster but we've since removed that in order to just fix the single instance Ray problems we've encountered.
bitbucket-pipeline.yaml
image: python:3.7.3
pipelines:
branches:
master:
- step:
image: atlassian/default-image:2
name: 'Build and Test'
script:
- zip -r careerfair-cluster-service.zip . -x '*.git*'
# Define an artifact to pass the zip file to the next step
artifacts:
- careerfair-cluster-service.zip
- step:
image: python:3.7.3
name: 'Deploy code to elasticbeanstalk'
caches:
- pip
script: # Modify the commands below to build your repository.
- pip install -U setuptools
- pip install -U wheel
- pip install -U flask-cors
- pip install mod_wsgi-httpd
- pip install -r requirements.txt
- pipe: atlassian/aws-elasticbeanstalk-deploy:0.5.5
variables:
AWS_ACCESS_KEY_ID: '$AWS_ACCESS_KEY_ID'
AWS_SECRET_ACCESS_KEY: '$AWS_SECRET_ACCESS_KEY'
AWS_DEFAULT_REGION: 'us-west-1'
APPLICATION_NAME: 'careerfair-cluster-service'
ENVIRONMENT_NAME: 'ClusterServiceProduction'
ZIP_FILE: 'careerfair-cluster-service.zip'
ENVIRONMENT: 'PRODUCTION'
FLASK_APP_PATH: '/opt/python/current/app'
PORT: 80
- step:
image: python:3.7.3
name: 'Deploy code to elasticbeanstalk worker'
caches:
- pip
script: # Modify the commands below to build your repository.
- pip install -U setuptools
- pip install -U wheel
- pip install -U flask-cors
- pip install mod_wsgi-httpd
- pip install -r requirements.txt
- rm -rf .platform
- pipe: atlassian/aws-elasticbeanstalk-deploy:0.5.5
variables:
AWS_ACCESS_KEY_ID: '$AWS_ACCESS_KEY_ID'
AWS_SECRET_ACCESS_KEY: '$AWS_SECRET_ACCESS_KEY'
AWS_DEFAULT_REGION: 'us-west-1'
APPLICATION_NAME: 'careerfair-cluster-service'
ENVIRONMENT_NAME: 'ClusterServiceRepeatWorker'
ZIP_FILE: 'careerfair-cluster-service.zip'
ENVIRONMENT: 'PRODUCTION'
VERSION_LABEL: 'cluster-service-$BITBUCKET_BUILD_NUMBER-repeater'
FLASK_APP_PATH: '/opt/python/current/app'
THREADED: 'False'
PORT: 80
wsgi.py
import sys
sys.stdout = sys.__stdout__
sys.stderr = sys.__stderr__

Related

Django unspecified error when deploying on Apache2

Below is the error when I try deploy Django==3.2.12, wagtail==2.16.1, python 3.8.2, mod_wsgi 4.9 on a Debian 11 server. I have a full stack trace at the end.
class SimpleLazyObject(LazyObject):
TypeError: Error when calling the metaclass bases
'property' object is not callable
When I run this on my local dev machine which is a Mac it works just fine. I found someone with the exact same problem but no clarity about how it was resolved.
The resources I have been using to assist are 1, 2, 3, 4. I have tried installing mod_wsgi using pip and as well as from sources. Used various guides for Apache2 config. Upgraded from python 3.8 to 3.9 as well as downgraded to 3.7.
Create interpreter '0.0.0.0|'.
[Tue Mar 29 11:49:06.679710 2022] [wsgi:info] [pid 199764:tid 139683953432320] mod_wsgi (pid=199764): Adding '/var/www/html/portal' to path.
[Tue Mar 29 11:49:06.680057 2022] [wsgi:info] [pid 199764:tid 139683953432320] mod_wsgi (pid=199764): Adding '/var/www/html/portal/portalvenv/lib/python3.8/site-packages' to path.
[Tue Mar 29 11:49:06.689628 2022] [wsgi:info] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy] mod_wsgi (pid=199764, process='saida-befree_portal', application='0.0.0.0|'): Loading Python script file '/var/www/html/portal/portal/wsgi.py'.
[Tue Mar 29 11:49:06.705081 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy] mod_wsgi (pid=199764): Failed to exec Python script file '/var/www/html/portal/portal/wsgi.py'.
[Tue Mar 29 11:49:06.713633 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy] mod_wsgi (pid=199764): Exception occurred processing WSGI script '/var/www/html/portal/portal/wsgi.py'.
[Tue Mar 29 11:49:06.713903 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy] Traceback (most recent call last):
[Tue Mar 29 11:49:06.714017 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy] File "/var/www/html/portal/portal/wsgi.py", line 12, in <module>
[Tue Mar 29 11:49:06.714210 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy] from django.core.wsgi import get_wsgi_application
[Tue Mar 29 11:49:06.714304 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy] File "/var/www/html/portal/portalvenv/lib/python3.8/site-packages/django/__init__.py", line 1, in <module>
[Tue Mar 29 11:49:06.717663 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy] from django.utils.version import get_version
[Tue Mar 29 11:49:06.717837 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy] File "/var/www/html/portal/portalvenv/lib/python3.8/site-packages/django/utils/version.py", line 7, in <module>
[Tue Mar 29 11:49:06.718002 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy] from django.utils.regex_helper import _lazy_re_compile
[Tue Mar 29 11:49:06.718072 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy] File "/var/www/html/portal/portalvenv/lib/python3.8/site-packages/django/utils/regex_helper.py", line 10, in <module>
[Tue Mar 29 11:49:06.718305 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy] from django.utils.functional import SimpleLazyObject
[Tue Mar 29 11:49:06.720700 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy] File "/var/www/html/portal/portalvenv/lib/python3.8/site-packages/django/utils/functional.py", line 362, in <module>
[Tue Mar 29 11:49:06.721066 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy] class SimpleLazyObject(LazyObject):
[Tue Mar 29 11:49:06.721539 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy] TypeError: Error when calling the metaclass bases
[Tue Mar 29 11:49:06.721610 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy] 'property' object is not callable
[Tue Mar 29 11:49:58.057546 2022] [reqtimeout:info] [pid 199765:tid 139683870795520] [client xx.xx.xx.xxx:yyyy] AH01382: Request header read timeout
I had the same issue so i did the following steps:
Remove the apache2 library by using the following command-
sudo apt-get remove python-pip apache2 libapache2-mod-wsgi
Then use the following command to install the correct library-
sudo apt-get install python3-pip apache2 libapache2-mod-wsgi-py3
This solved my error.

WSGI permission error when deploying flask app to apache2

[Mon Jan 24 17:01:59.755348 2022] [wsgi:error] [pid 6837:tid 139969656289024] [remote xxx.xxx.xxx.xxx:xxxxx] mod_wsgi (pid=6837): Failed to exec Python script file '/var/www/FlaskDeliverN/app.wsgi'.
[Mon Jan 24 17:01:59.755407 2022] [wsgi:error] [pid 6837:tid 139969656289024] [remote xxx.xxx.xxx.xxx:xxxxx] mod_wsgi (pid=6837): Exception occurred processing WSGI script '/var/www/FlaskDeliverN/app.wsgi'.
[Mon Jan 24 17:01:59.760074 2022] [wsgi:error] [pid 6837:tid 139969656289024] [remote xxx.xxx.xxx.xxx:xxxxx] Traceback (most recent call last):
[Mon Jan 24 17:01:59.760109 2022] [wsgi:error] [pid 6837:tid 139969656289024] [remote xxx.xxx.xxx.xxx:xxxxx] File "/var/www/FlaskDeliverN/app.wsgi", line 5, in <module>
[Mon Jan 24 17:01:59.760114 2022] [wsgi:error] [pid 6837:tid 139969656289024] [remote xxx.xxx.xxx.xxx:xxxxx] with open(activate_this) as file_:
[Mon Jan 24 17:01:59.760129 2022] [wsgi:error] [pid 6837:tid 139969656289024] [remote xxx.xxx.xxx.xxx:xxxxx] PermissionError: [Errno 13] Permission denied: '/root/.local/share/virtualenvs/FlaskDeliverN-8O9_IGcY/bin/activate_this.py'
I keep on getting the above error. I am not sure why there would be a permission error here. I checked that the file existed and wasn't empty so that's not the issue. I have looked through many tutorials on how to deploy a flask app but it never works and I think this may be why.
I followed this tutorial:https://www.youtube.com/watch?v=w0QDAg85Oow

Why apache find files on system root directory instead of project directory, I got error like FileNotFound

Apache does not find files on my project directory which is /var/www/web_app_video_synopsis but they find files/directories on system root '/'
when I hint the URL http://<server IP:5000>
The Apache get the error cat /var/log/apache2/error.log
[Mon May 18 09:14:42.292029 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] ERROR:main:Exception on / [GET]
[Mon May 18 09:14:42.292060 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] Traceback (most recent call last):
[Mon May 18 09:14:42.292064 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] File "/home/ubuntu/.virtualenvs/pytorch/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app
[Mon May 18 09:14:42.292068 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] response = self.full_dispatch_request()
[Mon May 18 09:14:42.292071 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] File "/home/ubuntu/.virtualenvs/pytorch/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
[Mon May 18 09:14:42.292075 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] rv = self.handle_user_exception(e)
[Mon May 18 09:14:42.292078 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] File "/home/ubuntu/.virtualenvs/pytorch/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception
[Mon May 18 09:14:42.292081 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] reraise(exc_type, exc_value, tb)
[Mon May 18 09:14:42.292084 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] File "/home/ubuntu/.virtualenvs/pytorch/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
[Mon May 18 09:14:42.292094 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] raise value
[Mon May 18 09:14:42.292097 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] File "/home/ubuntu/.virtualenvs/pytorch/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
[Mon May 18 09:14:42.292100 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] rv = self.dispatch_request()
[Mon May 18 09:14:42.292102 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] File "/home/ubuntu/.virtualenvs/pytorch/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request
[Mon May 18 09:14:42.292105 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] return self.view_functions[rule.endpoint](**req.view_args)
[Mon May 18 09:14:42.292108 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] File "/var/www/web_app_video_synopsis/main.py", line 147, in student
[Mon May 18 09:14:42.292111 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] thumbnail_list, _ = load_video_with_thumbnail()
[Mon May 18 09:14:42.292114 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] File "/var/www/web_app_video_synopsis/functions.py", line 87, in load_video_with_thumbnail
[Mon May 18 09:14:42.292117 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] for file in pathlib.Path.cwd().joinpath('Processed_Tasks').iterdir():
[Mon May 18 09:14:42.292120 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] File "/usr/lib/python3.6/pathlib.py", line 1081, in iterdir
[Mon May 18 09:14:42.292123 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] for name in self._accessor.listdir(self):
[Mon May 18 09:14:42.292125 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] File "/usr/lib/python3.6/pathlib.py", line 387, in wrapped
[Mon May 18 09:14:42.292128 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] return strfunc(str(pathobj), *args)
[Mon May 18 09:14:42.292133 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876] FileNotFoundError: [Errno 2] No such file or directory: '/Processed_Tasks'
[Mon May 18 09:14:42.292139 2020] [wsgi:error] [pid 16418:tid 140427906770688] [client 103.104.192.170:43876]
Processed_Tasks/ already exist in my project directory
here my project structure :
web_app_video_synopsis/
├── Downloaded_Thumbnail
├── Downloaded_Video
├── Processed_Tasks
├── Processed_Videos
├── Queue
├── README.md
├── centroid_tracker
├── database
├── functions.py
├── main.py
├── preprocessing.py
├── requirements.txt
├── static
├── templates
├── web_app_video_synopsis.wsgi
└── yolact_segmentation
Project configuration file /etc/apache2/sites-available/web_app_video_synopsis.conf:
WSGIPythonPath /var/www/www/web_app_video_synopsis
<VirtualHost *:5000>
ServerName http://<Server IP>
DocumentRoot /var/www/web_app_video_synopsis/
WSGIScriptAlias / /var/www/web_app_video_synopsis/web_app_video_synopsis.wsgi
WSGIDaemonProcess web_app_video_synopsis python-path=/var/www/web_app_video_synopsis:/home/ubuntu/.virtualenvs/pytorch/lib/python3.6/site-packages/
WSGIProcessGroup web_app_video_synopsis
WSGIApplicationGroup %{GLOBAL}
<Directory /var/www/web_app_video_synopsis/>
Order allow,deny
Allow from all
</Directory>
Alias /static /var/www/web_app_video_synopsis/static
<Directory /var/www/web_app_video_synopsis/static/>
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
web_app_video_synopsis.wsgi file
#!/usr/bin/python
import sys
import logging
import os
#activate_this = '/home/ubuntu/.virtualenvs/pytorch/bin/activate_this.py'
activate_this = os.path.expanduser("/home/ubuntu/.virtualenvs/pytorch/bin/activate_this.py")
with open(activate_this) as file_:
exec(file_.read(), dict(__file__=activate_this))
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/web_app_video_synopsis/")
from main import app as application
Error produce these lines in my code functions.py
for file in pathlib.Path.cwd().joinpath('Processed_Tasks').iterdir():
with open(file, mode='r') as f:
task_data = json.load(f)
In the local machine, the current working directory is the same where the main.py located in the project directory
So How I access(read/write/execute) files from /var/www/web_app_video_synopsis ?
Like my code, many files read and write in the project directory.
Solution
web_app_video_synopsis.wsgi file
#!/usr/bin/python
import sys
import logging
import os
#activate_this = '/home/ubuntu/.virtualenvs/pytorch/bin/activate_this.py'
activate_this = os.path.expanduser("/home/ubuntu/.virtualenvs/pytorch/bin/activate_this.py")
with open(activate_this) as file_:
exec(file_.read(), dict(__file__=activate_this))
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/web_app_video_synopsis/")
os.chdir("/var/www/web_app_video_synopsis")
from main import app as application
must set project directory using os.chdir
I got the solution, just add
os.chdir("/var/www/web_app_video_synopsis") in web_app_video_synopsis.wsgi and project directory set. I also edit my question with solution

Target WSGI script '/home/rajeshkumarponnu/Documents/OFFICE/IAB_PROJECT/iab_pro/wsgi.py' cannot be loaded as Python module

I am struggling to deploy the django rest api in apache with wsgi and getting 500 error. Here is my files, please suggest/help me where i am wrong.
Even so many facing same issues and i refered that also..but i could not able fix this error.
wsgi.py:
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'iab_pro.settings')
application = get_wsgi_application()
000-default.conf:
<VirtualHost *:80>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerName 192.0.18.111
ServerAdmin rajeshkumar.ponnusamy#indegene.com
WSGIScriptAlias / /home/rajeshkumarponnu/Documents/OFFICE/IAB_PROJECT/iab_pro/wsgi.py
<Directory /home/rajeshkumarponnu/Documents/OFFICE/IAB_PROJECT/iab_pro/>
<Files wsgi.py>
Require all granted
</Files>
Order allow,deny
Allow from all
</Directory>
WSGIDaemonProcess IAB_PROJECT python-path=/home/rajeshkumarponnu/Documents/OFFICE/IAB_PROJECT python-home=/home/rajeshkumarponnu/Documents/OFFICE/venv_iab
WSGIProcessGroup IAB_PROJECT
</VirtualHost>
apache error log
[Fri Jan 10 12:14:57.407703 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] mod_wsgi (pid=17242): Target WSGI script '/home/rajeshkumarponnu/Documents/OFFICE/IAB_PROJECT/iab_pro/wsgi.py' cannot be loaded as Python module.
[Fri Jan 10 12:14:57.407764 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] mod_wsgi (pid=17242): Exception occurred processing WSGI script '/home/rajeshkumarponnu/Documents/OFFICE/IAB_PROJECT/iab_pro/wsgi.py'.
[Fri Jan 10 12:14:57.408932 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] Traceback (most recent call last):
[Fri Jan 10 12:14:57.408972 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] File "/usr/lib/python3.6/logging/config.py", line 565, in configure
[Fri Jan 10 12:14:57.408978 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] handler = self.configure_handler(handlers[name])
[Fri Jan 10 12:14:57.408985 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] File "/usr/lib/python3.6/logging/config.py", line 738, in configure_handler
[Fri Jan 10 12:14:57.408989 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] result = factory(**kwargs)
[Fri Jan 10 12:14:57.408995 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] File "/usr/lib/python3.6/logging/__init__.py", line 1032, in __init__
[Fri Jan 10 12:14:57.408999 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] StreamHandler.__init__(self, self._open())
[Fri Jan 10 12:14:57.409007 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] File "/usr/lib/python3.6/logging/__init__.py", line 1061, in _open
[Fri Jan 10 12:14:57.409011 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] return open(self.baseFilename, self.mode, encoding=self.encoding)
[Fri Jan 10 12:14:57.409028 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] FileNotFoundError: [Errno 2] No such file or directory: '/logs/error.log'
[Fri Jan 10 12:14:57.409037 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210]
[Fri Jan 10 12:14:57.409041 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] During handling of the above exception, another exception occurred:
[Fri Jan 10 12:14:57.409044 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210]
[Fri Jan 10 12:14:57.409050 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] Traceback (most recent call last):
[Fri Jan 10 12:14:57.409078 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] File "/home/rajeshkumarponnu/Documents/OFFICE/IAB_PROJECT/iab_pro/wsgi.py", line 16, in <module>
[Fri Jan 10 12:14:57.409083 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] application = get_wsgi_application()
[Fri Jan 10 12:14:57.409092 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] File "/home/rajeshkumarponnu/Documents/OFFICE/venv_iab/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Fri Jan 10 12:14:57.409096 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] django.setup(set_prefix=False)
[Fri Jan 10 12:14:57.409102 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] File "/home/rajeshkumarponnu/Documents/OFFICE/venv_iab/lib/python3.6/site-packages/django/__init__.py", line 19, in setup
[Fri Jan 10 12:14:57.409114 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Fri Jan 10 12:14:57.409121 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] File "/home/rajeshkumarponnu/Documents/OFFICE/venv_iab/lib/python3.6/site-packages/django/utils/log.py", line 75, in configure_logging
[Fri Jan 10 12:14:57.409125 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] logging_config_func(logging_settings)
[Fri Jan 10 12:14:57.409131 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] File "/usr/lib/python3.6/logging/config.py", line 802, in dictConfig
[Fri Jan 10 12:14:57.409135 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] dictConfigClass(config).configure()
[Fri Jan 10 12:14:57.409140 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] File "/usr/lib/python3.6/logging/config.py", line 573, in configure
[Fri Jan 10 12:14:57.409144 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] '%r: %s' % (name, e))
[Fri Jan 10 12:14:57.409155 2020] [wsgi:error] [pid 17242:tid 140717350381312] [remote 192.0.18.111:49210] ValueError: Unable to configure handler 'file': [Errno 2] No such file or directory: '/logs/error.log'
I am using python3.6 in my system, so installed
sudo apt-get install libapache2-mod-wsgi-py3
I have tried with www-data:www-data for venev folder and as well as project folder (IAB_PROJECT) and gave 777 permission for all folders. But still same error.
Thanks in advance.
This tutorial gives a concise walkthrough on how to go about running a Django Api on an apache server, maybe it'll give you a hint on how to solve the problem. Good luck.

How to install nltk on an Amazon EC2 instance?

I am trying to install nltk on an Amazon EC2 instance using pip and virtual environment. nltk is listed in the requirements.txt file that pip uses. I also want to download punkt using the nltk.download('punkt') option.
Here's what my makefile looks like:
INSTANCE_NAME=toolsapp
ENV=env
LOAD_ENV=source $(ENV)/bin/activate
VIRTUALENV_BIN:=$(shell which virtualenv || echo /usr/local/bin/virtualenv )
EB_BIN:=$(shell $(LOAD_ENV) && which eb || echo /usr/local/bin/eb )
AWS_BIN:=$(shell $(LOAD_ENV) && which aws || echo /usr/local/bin/aws )
default: dev
.PHONY: default
# Ensure virtualenv is installed
$(VIRTUALENV_BIN):
pip3 install virtualenv
# Create a virtualenv folder called env/ and install dependencies
$(ENV): $(VIRTUALENV_BIN)
virtualenv -p python3 $(ENV)
$(LOAD_ENV) && pip install --upgrade pip && pip install -r requirements.txt
But this is the error I get when I try to run the webapp:
[Tue Jul 24 14:46:13.798460 2018] [:error] [pid 22801] model type: 9
[Tue Jul 24 14:46:13.801193 2018] [:error] [pid 22801] Traceback (most recent call last):
[Tue Jul 24 14:46:13.801227 2018] [:error] [pid 22801] File "/opt/python/run/venv/local/lib/python3.6/site-packages/sumy/nlp/tokenizers.py", line 79, in _get_sentence_tokenizer
[Tue Jul 24 14:46:13.801232 2018] [:error] [pid 22801] return nltk.data.load(path)
[Tue Jul 24 14:46:13.801239 2018] [:error] [pid 22801] File "/opt/python/run/venv/local/lib/python3.6/site-packages/nltk/data.py", line 836, in load
[Tue Jul 24 14:46:13.801242 2018] [:error] [pid 22801] opened_resource = _open(resource_url)
[Tue Jul 24 14:46:13.801247 2018] [:error] [pid 22801] File "/opt/python/run/venv/local/lib/python3.6/site-packages/nltk/data.py", line 954, in _open
[Tue Jul 24 14:46:13.801251 2018] [:error] [pid 22801] return find(path_, path + ['']).open()
[Tue Jul 24 14:46:13.801255 2018] [:error] [pid 22801] File "/opt/python/run/venv/local/lib/python3.6/site-packages/nltk/data.py", line 675, in find
[Tue Jul 24 14:46:13.801259 2018] [:error] [pid 22801] raise LookupError(resource_not_found)
[Tue Jul 24 14:46:13.801274 2018] [:error] [pid 22801] LookupError:
[Tue Jul 24 14:46:13.801278 2018] [:error] [pid 22801] **********************************************************************
[Tue Jul 24 14:46:13.801280 2018] [:error] [pid 22801] Resource \x1b[93mpunkt\x1b[0m not found.
[Tue Jul 24 14:46:13.801283 2018] [:error] [pid 22801] Please use the NLTK Downloader to obtain the resource:
[Tue Jul 24 14:46:13.801285 2018] [:error] [pid 22801]
[Tue Jul 24 14:46:13.801288 2018] [:error] [pid 22801] \x1b[31m>>> import nltk
[Tue Jul 24 14:46:13.801299 2018] [:error] [pid 22801] >>> nltk.download('punkt')
[Tue Jul 24 14:46:13.801301 2018] [:error] [pid 22801] \x1b[0m
[Tue Jul 24 14:46:13.801303 2018] [:error] [pid 22801] Searched in:
[Tue Jul 24 14:46:13.801305 2018] [:error] [pid 22801] - '/home/wsgi/nltk_data'
[Tue Jul 24 14:46:13.801307 2018] [:error] [pid 22801] - '/usr/share/nltk_data'
[Tue Jul 24 14:46:13.801310 2018] [:error] [pid 22801] - '/usr/local/share/nltk_data'
[Tue Jul 24 14:46:13.801312 2018] [:error] [pid 22801] - '/usr/lib/nltk_data'
[Tue Jul 24 14:46:13.801314 2018] [:error] [pid 22801] - '/usr/local/lib/nltk_data'
[Tue Jul 24 14:46:13.801316 2018] [:error] [pid 22801] - '/opt/python/run/venv/nltk_data'
[Tue Jul 24 14:46:13.801318 2018] [:error] [pid 22801] - '/opt/python/run/venv/share/nltk_data'
[Tue Jul 24 14:46:13.801320 2018] [:error] [pid 22801] - '/opt/python/run/venv/lib/nltk_data'
[Tue Jul 24 14:46:13.801322 2018] [:error] [pid 22801] - ''
[Tue Jul 24 14:46:13.801325 2018] [:error] [pid 22801] **********************************************************************
[Tue Jul 24 14:46:13.801327 2018] [:error] [pid 22801]
[Tue Jul 24 14:46:13.801342 2018] [:error] [pid 22801]
[Tue Jul 24 14:46:13.801345 2018] [:error] [pid 22801] During handling of the above exception, another exception occurred:
[Tue Jul 24 14:46:13.801348 2018] [:error] [pid 22801]
[Tue Jul 24 14:46:13.801352 2018] [:error] [pid 22801] Traceback (most recent call last):
[Tue Jul 24 14:46:13.801369 2018] [:error] [pid 22801] File "/opt/python/current/app/summarization.py", line 40, in reform
[Tue Jul 24 14:46:13.801372 2018] [:error] [pid 22801] parser = HtmlParser.from_url(inputFile, Tokenizer("english"))
[Tue Jul 24 14:46:13.801377 2018] [:error] [pid 22801] File "/opt/python/run/venv/local/lib/python3.6/site-packages/sumy/nlp/tokenizers.py", line 67, in __init__
[Tue Jul 24 14:46:13.801380 2018] [:error] [pid 22801] self._sentence_tokenizer = self._get_sentence_tokenizer(tokenizer_language)
[Tue Jul 24 14:46:13.801385 2018] [:error] [pid 22801] File "/opt/python/run/venv/local/lib/python3.6/site-packages/sumy/nlp/tokenizers.py", line 82, in _get_sentence_tokenizer
[Tue Jul 24 14:46:13.801388 2018] [:error] [pid 22801] "NLTK tokenizers are missing. Download them by following command: "
[Tue Jul 24 14:46:13.801397 2018] [:error] [pid 22801] LookupError: NLTK tokenizers are missing. Download them by following command: python -c "import nltk; nltk.download('punkt')"
[Tue Jul 24 14:46:13.801414 2018] [:error] [pid 22801] unable to read https://webapp-input.s3.amazonaws.com/43629be5a07a43029f359abd1340ad08.input.txt?AWSAccessKeyId=ASIAI4UVLLOHEUNNKWNQ&Signature=NBbRoAhFB5mP3SNi3jR6rDcz8LY%3D&x-amz-security-token=FQoDYXdzEHgaDKt%2FFOhHU4UQgQLgdCK3A3amyJ9mziqpLJ01DR5yYqszDzAfi8e9B9Uj1xw9pJw4yDqyF5KFtul7D7o6Xm2qX%2FQvSb9tbnMoW2r8Pur%2FbhlJnhfKFUriT6ggk0THgAgXQWQ8pDOIIMOjn7XZLtFvTfWttukS40VC17geWmEod%2FsO9IZh3LyhN46V%2FdDQo21YZfZFRoQbFHgTd823mnnTLwNoZs51B%2BluwOJ70U22P0K%2FdhzFGVEEGj%2FDiT1oC%2B1aGHQoK4h9JC45%2BqdetOoxZZsdc2z8hxFPQbTW59AT2L4PC2icjkzjJ9prhJvzU25iuZeYoO5tC3SZ1fpNtJ5QCiBYdK1R1c0TRygeOGbev24j5qlTb5DLG4HknH47S6XBMKE%2Fs4EyEo2zNbu%2Fg7QhcebwjJ9%2FMcCpmbMV60H2cj2zMxk8gzV83E%2B19CODShcUQ7WSmNcXj5dyupEJ8SCHRBABBXhOZ8wzMLwU%2BgJy59DTzXl7ZZH1t0LzaOQLPSvjdqu%2FPNGhn1M7K4vVNti93hOCWsK0T3tltg9gfIjFF90gHSawS708WvcyUTmN%2BLD7m3cMJ9B9g9adISSU5d4NS7ohPyX%2FEQMom%2FDc2gU%3D&Expires=1532447173.
Add scripts to download the required models after installing nltk.
python3 -m nltk.downloader punkt
python3 -m nltk.downloader stopwords

Resources