4

I am trying to import python natural language processing toolkit nltk in node.js using node-python mentioned here: https://npmjs.org/package/node-python

The commands i am giving are similar as mentioned on the npm module site:

var python = require('node-python');
var os = python.import('os');

i am getting the following error:

Error: /usr/lib/python2.7/lib-dynload/datetime.so: undefined symbol: PyExc_SystemError
    at repl:1:25
    at REPLServer.self.eval (repl.js:109:21)
    at rli.on.self.bufferedCmd (repl.js:258:20)
    at REPLServer.self.eval (repl.js:116:5)
    at Interface.<anonymous> (repl.js:248:12)
    at Interface.EventEmitter.emit (events.js:96:17)
    at Interface._onLine (readline.js:200:10)
    at Interface._line (readline.js:518:8)
    at Interface._ttyWrite (readline.js:736:14)
    at ReadStream.onkeypress (readline.js:97:10)

I am using python2.7.2 After much search i found that this is a known bug in python2.7 and found a similar problem when importing from C here is the what i found: similar error found while importing python datetime module from C

The problem seems to be in the datetime.so module, i was thinking of getting the updated version of the datetime module and compiling it separately to make it work. I am still looking for that module and comple instructions. I would really appreciate If anyone has a better suggestion to resolve this or even help me locate the place to find this datetime module and its compile instructions. I really don't want to compile the whole python to make it work.

4
  • Did you try updating the datetime module? I would like to use NLTK via node as well. Commented Dec 31, 2013 at 16:06
  • 1
    No, apparently you have to manually compile python to make it work, and i was not ready for that, a lot of other stuff is using my current python installation. I ended up making a small web service in python itself and used it with nodejs http module. here is the final thing: conterface.herokuapp.com Commented Dec 31, 2013 at 18:18
  • Thanks, that sounds like a lot less pain than recompiling python std libs. I also considered using a AMQP layer (rabbitMQ, etc..) to connect things like NLTK or even StanfordNLP. Your app looks like it works well. Commented Jan 1, 2014 at 16:02
  • I guess if you are building a high load system you may want to do that. Thanks for trying out the app. Commented Jan 1, 2014 at 19:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.