Skip to content
Tim L edited this page Jul 4, 2014 · 55 revisions

What is first

What we will cover

We'll show typical error messages that we've seen and tell you how to remedy them.

Let's get to it

Hashing modules are deprecated

/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/internet/_sslverify.py:5:
 DeprecationWarning: the md5 module is deprecated; use hashlib instead
  import itertools, md5
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/python/filepath.py:12:
 DeprecationWarning: the sha module is deprecated; use the hashlib module instead
  import sha

ignore them :-) Or ask Jim to fix it.

rdflib is not installed

Traceback (most recent call last):
  File "/opt/DataFAQs/bin/df-core.py", line 11, in <module>
    from rdflib import *
ImportError: No module named rdflib
sudo easy_install -U rdflib==3.2.0

(the older way:)

http://www.rdflib.net/2.4.0/ and http://code.google.com/p/rdflib/

easy_install -U rdflib==2.4.0

rdfextras not installed

   results = graph.query(queries[type], initNs=prefixes)
 File "build/bdist.macosx-10.7-intel/egg/rdflib/graph.py", line 884, in query
 File "build/bdist.macosx-10.7-intel/egg/rdflib/plugin.py", line 96, in get
 File "build/bdist.macosx-10.7-intel/egg/rdflib/plugin.py", line 59, in getClass
ImportError: No module named rdfextras.sparql.query

(very poor documentation on this)

sudo easy_install rdfextras

SuRF is not installed

Traceback (most recent call last):
 File "/opt/DataFAQs/bin/df-core.py", line 13, in <module>
   from surf import *
ImportError: No module named surf

From http://packages.python.org/SuRF/install.html

easy_install surf

SuRF's sparql_protocol is not installed

  File "/usr/local/lib/python2.6/dist-packages/SuRF-1.1.4_r352-py2.6.egg/surf/store.py", line 85, in __init__
    raise PluginNotFoundException('The <%s> READER plugin was not found' % (reader))
surf.plugin.manager.PluginNotFoundException: The <sparql_protocol> READER plugin was not found
sudo easy_install -U surf.rdflib

http://packages.python.org/SuRF/install.html

SuRF's allegro_franz is not installed

Since allegrograph is so hard to install, and partial installs break any python invocations,

rm -rf /Library/Python/2.7/site-packages/surf.allegro_franz-0.2.2_r348-py2.7.egg /Library/Python/2.7/site-packages/franz
  File "surf-ag.rpy", line 9, in <module>
    repository = 'datafaqs')
  File "/Library/Python/2.7/site-packages/SuRF-1.1.4_r352-py2.7.egg/surf/store.py", line 85, in __init__
    raise PluginNotFoundException('The <%s> READER plugin was not found' % (reader))
surf.plugin.manager.PluginNotFoundException: The <allegro_franz> READER plugin was not found

From http://packages.python.org/SuRF/install.html#installing-surf-plugins:

easy_install -U surf.allegro_franz

SuRF depends on pre-4 rdflib

  File "/usr/local/lib/python2.7/dist-packages/SuRF-1.1.4_r352-py2.7.egg/surf/rdf.py", line 63, in <module>
    __exports__ = [BNode, ClosedNamespace, ConjunctiveGraph, Graph, Literal,
NameError: name 'BNode' is not defined

See https://github.com/timrdf/DataFAQs/issues/125

AllegroGraph's API is not installed

Traceback (most recent call last):
  File "surf-ag.rpy", line 9, in <module>
    repository = 'datafaqs')
  File "/Library/Python/2.7/site-packages/SuRF-1.1.4_r352-py2.7.egg/surf/store.py", line 72, in __init__
    load_plugins()
  File "/Library/Python/2.7/site-packages/SuRF-1.1.4_r352-py2.7.egg/surf/plugin/manager.py", line 72, in load_plugins
    __init_plugins(__readers__, __ENTRYPOINT_READER__)
  File "/Library/Python/2.7/site-packages/SuRF-1.1.4_r352-py2.7.egg/surf/plugin/manager.py", line 60, in __init_plugins
    plugin_class = entrypoint.load()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1954, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/Library/Python/2.7/site-packages/surf.allegro_franz-0.2.2_r348-py2.7.egg/allegro_franz/reader.py", line 39, in <module>
  File "/Library/Python/2.7/site-packages/surf.allegro_franz-0.2.2_r348-py2.7.egg/allegro_franz/util.py", line 38, in <module>
ImportError: No module named franz.openrdf.model.value

cjson not installed (AG dependency)

Traceback (most recent call last):
  File "surf-ag.rpy", line 9, in <module>
    repository = 'datafaqs')
  File "/Library/Python/2.7/site-packages/SuRF-1.1.4_r352-py2.7.egg/surf/store.py", line 72, in __init__
    load_plugins()
  File "/Library/Python/2.7/site-packages/SuRF-1.1.4_r352-py2.7.egg/surf/plugin/manager.py", line 72, in load_plugins
    __init_plugins(__readers__, __ENTRYPOINT_READER__)
  File "/Library/Python/2.7/site-packages/SuRF-1.1.4_r352-py2.7.egg/surf/plugin/manager.py", line 60, in __init_plugins
    plugin_class = entrypoint.load()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1954, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/Library/Python/2.7/site-packages/surf.allegro_franz-0.2.2_r348-py2.7.egg/allegro_franz/reader.py", line 42, in <module>
  File "/Library/Python/2.7/site-packages/franz/openrdf/sail/allegrographserver.py", line 29, in <module>
    from ...miniclient import repository as miniserver
  File "/Library/Python/2.7/site-packages/franz/miniclient/repository.py", line 1, in <module>
    import time, cjson, math
ImportError: No module named cjson

Need gcc development packages to address LLVM error (but just give up on AG all together...)

pycurl is not installed (AG dependency)

SADI is not installed

$ python tag-dataset.rpy 
Traceback (most recent call last):
  File "tag-dataset.rpy", line 1, in <module>
    import sadi
ImportError: No module named sadi

From http://packages.python.org/SuRF/install.html#installing-surf-plugins

easy_install -U surf.sparql_protocol

See SADI Semantic Web Services framework for the command to the latest install sadi.py in the downloads section:

sudo easy_install http://sadi.googlecode.com/files/sadi-0.1.4-py2.6.egg 

(not sure if the following error matters)

Installed /Library/Python/2.7/site-packages/sadi-0.1.4-py2.6.egg
Processing dependencies for sadi==0.1.4
Searching for sadi==0.1.4
Reading http://pypi.python.org/simple/sadi/
Couldn't find index page for 'sadi' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for sadi==0.1.4
error: Could not find suitable distribution for Requirement.parse('sadi==0.1.4')

pyparsing not installed

Traceback (most recent call last):
  File "/opt/DataFAQs/bin/df-core.py", line 85, in <module>
    results = graph.query(queries[type], initNs=prefixes)
  File "/usr/local/lib/python2.6/dist-packages/rdflib-3.2.0-py2.6.egg/rdflib/graph.py", line 886, in query
    processor = plugin.get(processor, query.Processor)(self)
  File "/usr/local/lib/python2.6/dist-packages/rdflib-3.2.0-py2.6.egg/rdflib/plugin.py", line 96, in get
    return p.getClass()
  File "/usr/local/lib/python2.6/dist-packages/rdflib-3.2.0-py2.6.egg/rdflib/plugin.py", line 59, in getClass
    module = __import__(self.module_path, globals(), locals(), [""])
  File "/usr/local/lib/python2.6/dist-packages/rdfextras-0.1-py2.6.egg/rdfextras/sparql/processor.py", line 2, in <module>
    import rdfextras.sparql.parser
  File "/usr/local/lib/python2.6/dist-packages/rdfextras-0.1-py2.6.egg/rdfextras/sparql/parser.py", line 5, in <module>
    from pyparsing import (Regex, Suppress, Combine, Optional, CaselessKeyword,
ImportError: No module named pyparsing

http://pyparsing.wikispaces.com/Download+and+Installation

sudo easy_install pyparsing

CKAN python client not installed

$ python tag-dataset.rpy 
Traceback (most recent call last):
  File "tag-dataset.rpy", line 12, in <module>
    import ckanclient
ImportError: No module named ckanclient

See CKAN for the command to install CKAN's python client:

sudo easy_install http://pypi.python.org/packages/source/c/ckanclient/ckanclient-0.9.tar.gz#md5=cb6d09eb2e60a01bce60c82c6c3a0c85
*/*
*/*
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
application/x-www-form-urlencoded
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/web/http.py", line 1402, in rawDataReceived
    self._finishRequestBody(data[self.length:])
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/web/http.py", line 1337, in _finishRequestBody
    self.allContentReceived()
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/web/http.py", line 1391, in allContentReceived
    req.requestReceived(command, path, version)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/web/http.py", line 714, in requestReceived
    self.process()
--- <exception caught here> ---
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/web/server.py", line 150, in process
    self.render(resrc)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/web/server.py", line 157, in render
    body = resrc.render(self)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/web/resource.py", line 190, in render
    return m(request)
  File "/Library/Python/2.6/site-packages/sadi-0.1.3-py2.6.egg/sadi/sadi.py", line 257, in render_POST
    graph = self.processGraph(content, request.getHeader("Content-Type"))
  File "/Library/Python/2.6/site-packages/sadi-0.1.3-py2.6.egg/sadi/sadi.py", line 203, in processGraph
    self.deserialize(inputStore.reader.graph, content, type)
  File "/Library/Python/2.6/site-packages/sadi-0.1.3-py2.6.egg/sadi/sadi.py", line 127, in deserialize
    format = self.getFormat(mimetype)
  File "/Library/Python/2.6/site-packages/sadi-0.1.3-py2.6.egg/sadi/sadi.py", line 119, in getFormat
    if type != None: return [type,self.contentTypes[type]]
exceptions.KeyError: ''

DISTINCT does not work in RDFLIB in Python?

predicate_counter = 0
        for row in temp_graph.query('SELECT ?p WHERE {?s ?p ?o.} ORDER BY ?p'):
            predicate_counter = predicate_counter + 1
        dataset['extras']['number of different predicate'] = predicate_counter

returns the same results as :

predicate_counter = 0
        for row in temp_graph.query('SELECT DISTINCT ?p WHERE {?s ?p ?o.} ORDER BY ?p'):
            predicate_counter = predicate_counter + 1
        dataset['extras']['number of different predicate'] = predicate_counter

Twisted not installed

Twisted is already installed on Macs (/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted). But if trying to run a stand-alone SADI service on something like Ubuntu, you will get the following error if twistd is not installed:

root@datafaqs:/opt/DataFAQs/services/sadi/faqt/access# python void-datadump.py 
void-datadump running on port 9227. Invoke it with:
curl -H "Content-Type: text/turtle" -d @my.ttl http://localhost:9227/void-datadump
Traceback (most recent call last):
  File "void-datadump.py", line 116, in <module>
    sadi.publishTwistedService(resource, port=resource.dev_port)
  File "/usr/local/lib/python2.6/dist-packages/sadi-0.1.5-py2.6.egg/sadi/sadi.py", line 498, in publishTwistedService
    raise Exception("Twisted isn't installed in this Python environment, and is needed to run a SADI service through twisted.")
Exception: Twisted isn't installed in this Python environment, and is needed to run a SADI service through twisted.

http://twistedmatrix.com/trac/wiki/Downloads

sudo apt-get install python-twisted

libraptor2.so.0

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

What's next

Clone this wiki locally