deploying js with python and spacy lib - javascript

I have never setup things this way, I got it running locally but have no clue how I should have do it when I deploy it into an ec2 server
I have a node app running already in ec2 server but recently I have added spaCy into one of my api.
The basic logic is calling the api which runs node and part of the js script uses spawn to process the proc.py file and do some calculation with outputs.
I have tried the following below to setup on my server but of course it failed when calling the api
my original node app is in /var/www/myApp
I used sudo apt install virtualenv then inside my /var/www/myApp I ran the command virtualenv venv which creates the virtual environment...
I did a source venv/bin/activate to get into the virtual environment
Then I started running the commands to install spacy mentioned in the spacy documentation https://github.com/explosion/spaCy
used this command to install pip install -U spacy and python -m spacy download en
Then I ran python -m spacy validate to see if spacy is installed which I got
Installed models (spaCy v2.0.11)
/var/www/myApp/venv/local/lib/python2.7/site-packages/spacy
TYPE NAME MODEL VERSION
package en-core-web-sm en_core_web_sm 2.0.0 ✔
link en en_core_web_sm 2.0.0 ✔
which I believe this means the installation is a success.
But after this, I am not sure what I should do to continue.
I tried running my api but getting this as an error message "err": "Traceback (most recent call last):\n"
I would believe the spacy module is not being called that's why I am getting this error but I am not sure what I should do to get this working.
Would really appreciate for any help, thanks in advance for any advices.
EDIT:
my proc.py code is below
if __name__ == '__main__':
import sys
import json
import spacy
nlp = spacy.load('en')
text = sys.argv[1]
doc = nlp(text)
all_noun_tokens = [ token.lemma_ for token in doc
if (token.pos_ == 'PROPN'
or token.pos_ == 'NOUN'
or token.tag_ == 'NN'
or token.tag_ == 'NNP') ]
print(json.dumps(all_noun_tokens))
P.S. I am wondering if there's any config that I need to do in order for my app to find where the virtuanenv is so it can detect the spacy module?

Related

soffice not found, even though libreoffice buildpack is installed - heroku server

I am using a npm package called libreoffice-convert which needs libre office installed to work. I have installed the libre office build pack on the heroku server where this node app is deployed however whenever I try and run this package I still an get Error: Could not find soffice binary

How to create NodeJS server using http-server?

I am new to Nodejs and would like to know how to use http server using the modejs http-server module.
I did the following steps:
1. Installed Nodejs.
2. Installed http-server module using the command : npm install http-server -g
3. Created a folder with a HTML doc
Once I start the server using the command http-server, the URL provides the following output:
192.168.1.5 sent an invalid response
CMD commmand :
C:\Users\user\folderLocation>http-server
HTML output :
192.168.1.5 sent an invalid response
Pls. do help with with this issue and provide feedback with what i'm doing wrong.
Thanks in advance!!
http-server -p8080 . //serves current directory
http-server -p8080 ./public //serves directory named public
https://www.npmjs.com/package/http-server
Apparently there is a bug in a dependency of the recent version of http-server. One solution is to install http-server#0.9.0

MeteorJS : How do I check the data fetching from mongoDB on console client?

We have deploy the MeteorJS code on Ubuntu server. We haven't created any client to access this MeteorJS service. First we wanted to verify the service are running properly. Can any one suggest the steps for check the deployment is correct.
We install Meteor on Ubuntu : curl https://install.meteor.com/ | sh
MonogoDB - Already install for NodeJS application - Its Working!
Copy the Code Meteor Code to server using WinSCP
Set the MongoDB path for Code : export MONGO_URL=mongodb://ip:27017/userDB
Run Command to start the app: sudo nohup meteor --port 3001 --production &
Thanks.

Meteor and mongodg exit code 1 on debian wheezy

i just finished installing my all-new debian wheezy distribution. I would like to install the meteor framework, so I did:
sudo curl https://install.meteor.com/ | sh
as recommended by the official meteor website, but during the installation I get this error when I type meteor after creating a new meteor project:
=> Started proxy.
Unexpected mongo exit code 1. Restarting.
Unexpected mongo exit code 1. Restarting.
Unexpected mongo exit code 1. Restarting.
Can't start Mongo server.
MongoDB failed global initialization
Looks like MongoDB doesn't understand your locale settings. See
https://github.com/meteor/meteor/issues/4019 for more details
In fact, once a new project is created and operational after coding, the meteor command run a localhost web server on port 3000 and then we can see the web application.
I don't understand why I get this error. Is it possible that my problems are coming from my debian distribution?
Do: $: LC_ALL=<your language>
where is the system language. Like de_DE.UTF-8 or en_US.UTF-8
in console:
export PORT=3000
export MONGO_URL=mongodb://127.0.0.1:27017/meteor
export ROOT_URL=http://localhost:3000
export HTTP_FORWARDED_COUNT=1

Trouble deploying Node.js app to heroku

I have tested and completed a version of my app that uses Node.js and more specifically it incorporates the node twitter module. When following Heroku's deployment guide and I execute heroku git:clone -a groupmetweetbot I get the following output in the console:
If I continue on and execute the following:
$ cd groupmetweetbot
$ git add .
$ git commit -am "make it better"
$ git push heroku master
the console tells me that the app is deployed.
This leaves me with a few questions. How can I fic this filename too long issue? I can't find any easy answer on how to start and sleep my app on Heroku. Any help is greatly appreciated.
you're hitting this bug https://github.com/npm/npm/issues/3697
you could try using npm v3

Categories