Can't launch Python API

66 views
Skip to first unread message

Pavel Savyuk

unread,
Aug 1, 2017, 4:18:16 AM8/1/17
to opencog
Hi everyone,
I'm new to OpenCog. Knew about it for a few years and finally decided to start exploring!
I'm going through the tutorials now, and I'm stuck at launching the Python API. I could successfully run the code in http://wiki.opencog.org/w/Getting_Started_with_Atoms_and_the_Scheme_Shell, so I assume that at least some OpenCog modules are working properly.
However, now, when I try to launch the REST API as described in http://wiki.opencog.org/w/Using_the_REST_API, I am getting errors.

I noticed that one of the directories that should be added to PYTHONPATH(/usr/local/share/opencog/python) does not exist on my system. The only directory in /usr/local/share/opencog is scm. I don't know if this is normal.

I located start_restapi.py in /home/pavel/opencog/examples/restapi/. Upon launching I got the error that the module 'opencog.cogserver' could not be found. I located cogserver/cogserver.py in /home/pavel/opencog/opencog/python/test_atomspace and added that to PYTHONPATH. The I got this error:

/home/pavel/opencog/opencog/python/web/api/apimain.py:4: ExtDeprecationWarning: Importing flask.ext.restful is deprecated, use flask_restful instead.
 
from flask.ext.restful import Api
/home/pavel/opencog/opencog/python/web/api/apimain.py:5: ExtDeprecationWarning: Importing flask.ext.cors is deprecated, use flask_cors instead.
 
from flask.ext.cors import CORS
/home/pavel/opencog/opencog/python/web/api/apiatomcollection.py:4: ExtDeprecationWarning: Importing flask.ext.restful.reqparse is deprecated, use flask_restful.reqparse instead.
 
from flask.ext.restful import Resource, reqparse, marshal
/home/pavel/opencog/opencog/python/web/api/mappers.py:12: ExtDeprecationWarning: Importing flask.ext.restful.fields is deprecated, use flask_restful.fields instead.
 
from flask.ext.restful import fields, marshal
/home/pavel/opencog/opencog/python/web/api/apiatomcollection.py:8: ExtDeprecationWarning: Importing flask.ext.restful.utils is deprecated, use flask_restful.utils instead.
 
from flask.ext.restful.utils import cors
/home/pavel/opencog/opencog/python/web/api/apiatomcollection.py:8: ExtDeprecationWarning: Importing flask.ext.restful.utils.cors is deprecated, use flask_restful.utils.cors instead.
 
from flask.ext.restful.utils import cors
Traceback (most recent call last):
 
File "/home/pavel/opencog/examples/restapi/start_restapi.py", line 1, in <module>
   
from web.api.apimain import RESTAPI
 
File "/home/pavel/opencog/opencog/python/web/api/apimain.py", line 9, in <module>
   
from apischeme import *
 
File "/home/pavel/opencog/opencog/python/web/api/apischeme.py", line 5, in <module>
   
from opencog.scheme_wrapper import scheme_eval, __init__
 
File "atomspace.pxd", line 143, in init opencog.scheme_wrapper (/tmp/atomspace-master/build/opencog/cython/opencog/scheme_wrapper.cpp:1628)
KeyError: '__pyx_vtable__'


This is where I'm stuck. Please help! :)
My system is Ubuntu 14.04 server.

Pavel



Pavel Savyuk

unread,
Aug 1, 2017, 8:05:08 AM8/1/17
to opencog
OK, after killing the VM and restarting from scratch I got it working.
The problem was that in http://wiki.opencog.org/w/Using_the_REST_API the export command was 
    export PYTHONPATH="${PYTHONPATH}:/home/<USERNAME>/opencog/opencog/opencog/cython"
when it should be
    export PYTHONPATH="${PYTHONPATH}:/home/<USERNAME>/opencog/build/opencog/cython"

Linas Vepstas

unread,
Aug 3, 2017, 2:31:29 AM8/3/17
to opencog
thanks .. I fixed the wiki page, I think its correct now. --linas

--
You received this message because you are subscribed to the Google Groups "opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opencog+unsubscribe@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at https://groups.google.com/group/opencog.
To view this discussion on the web visit https://groups.google.com/d/msgid/opencog/5bd35bdd-0886-4c29-91a1-88a5b1269c2a%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages