I have deployed my project in elastic-beanstack, I need to setup python3, numpy and nltk environment to it.
We have a python code with python3, numpy and nltk, We are interacting to python code with nodejs Child process. In my local machine it works good.
To setup on EB, We initiated EB cli in our project and installed python3, numpy, nltk through EB CLI
sudo yum -y update
sudo yum -y install yum-utils
sudo yum -y groupinstall development
sudo yum install pip3
pip3 --version
--------> pip 19.0.2 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
sudo yum -y install python36u
sudo update-alternatives --config python
python
--------> Python 3.6.7
pip3 install nltk --user
pip3 install numpy --user
pip list
-->Package Version
nltk 3.4
numpy 1.16.1
pi 0.1.2
pip 19.0.2
setuptools 36.2.7
singledispatch 3.4.0.3
six 1.12.0
wheel 0.33.0
On executing the output we get error as nltk and numpy packages not fount.
How to setup python3, numpy, nltk in my elastic-beanstalk, Kindly help me on this.
Am I missing or I am totally in a wrong path.
What I am doing
In My Python Script
import sys, json
from nltk import RegexpTokenizer
import pickle
import numpy as np
np.dot(v1, v2)
With Python In my Express(Nodejs)
const { spawn } = require('child_process');
const ls = spawn('python', ['./scoring.py', JSON.stringify(qJSON)]);
ls.stdout.on('data', (data) => {
ERROR stderr: Traceback (most recent call last): stderr: File
"./scoring.py", line 7 stderr: from nltk import RegexpTokenizer
stderr: ImportErrorstderr: : stderr: No module named nltkstderr:
child process exited with code 1
With Python3 In my Express(Nodejs)
const { spawn } = require('child_process');
const ls = spawn('python3', ['./scoring.py', JSON.stringify(qJSON)]);
ls.stdout.on('data', (data) => {
Error: spawn python3 ENOENT at Process.ChildProcess._handle.onexit
(internal/child_process.js:232:19) at onErrorNT
(internal/child_process.js:407:16) at process._tickCallback
(internal/process/next_tick.js:63:19)Emitted 'error' event at: at
Process.ChildProcess._handle.onexit (internal/child_process.js:238:12)
at onErrorNT (internal/child_process.js:407:16) at
process._tickCallback (internal/process/next_tick.js:63:19)