FuXi
FuXi copied to clipboard
FuXi==1.4.production fails on "from rdflib.sparql.parser import parse" - ImportError: cannot import name parse
Hi - I'm trying to use the latest FuXi from a fresh virtualenv where I've installed rdflib and fuxi in a clean environment, and I'm getting the following error below. I've also included a couple of diagnostic python commands in case they're helpful. Perhaps this is just an issue related to my environment, but i'm not quite sure why it would be the case if I'm in a fresh environment and such a fundamental import is breaking FuXi from even starting. Any advice on what might be happening would be much appreciated.
$ FuXi --help
Traceback (most recent call last):
File "/Users/matthew/virtualenvs/test_fuxi/bin/FuXi", line 8, in <module>
load_entry_point('FuXi==1.4.production', 'console_scripts', 'FuXi')()
File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 318, in load_entry_point
File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 2221, in load_entry_point
File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 1954, in load
File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/FuXi-1.4.production-py2.7.egg/FuXi/Rete/CommandLine.py", line 10, in <module>
from FuXi.LP.BackwardFixpointProcedure import BackwardFixpointProcedure
File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/FuXi-1.4.production-py2.7.egg/FuXi/LP/BackwardFixpointProcedure.py", line 30, in <module>
from FuXi.SPARQL import EDBQuery, EDBQueryFromBodyIterator, ConjunctiveQueryMemoize
File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/FuXi-1.4.production-py2.7.egg/FuXi/SPARQL/__init__.py", line 8, in <module>
from FuXi.Rete.Magic import AdornedUniTerm
File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/FuXi-1.4.production-py2.7.egg/FuXi/Rete/Magic.py", line 39, in <module>
from rdflib.sparql.parser import parse
ImportError: cannot import name parse
(test_fuxi)Goblin:tmp matthew$ which FuXi
/Users/matthew/virtualenvs/test_fuxi/bin/FuXi
(test_fuxi)Goblin:tmp matthew$ python -c "import rdflib.sparql.parser as foo; print foo"
<module 'rdflib.sparql.parser' from '/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/rdflib-2.4.2-py2.7-macosx-10.6-intel.egg/rdflib/sparql/parser.pyc'>
(test_fuxi)Goblin:tmp matthew$ python -c "import rdflib.sparql.parser as foo; print str(dir(foo))"
['GraphPattern', 'Optional', 'URIRef', 'Union', 'Where', '_StackManager', '__builtins__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '_buildGraphPattern', '_buildQueryArgs', '_escape', '_escapeLiterals', '_findStatements', '_getStatements', '_listTypes', '_makeList', '_parseSelect', '_parseWhere', '_parser', '_resolveBase', '_resolvePrefixes', '_resolveShorthand', '_unescape', 'base64', 'doSPARQL', 're']
(test_fuxi)Goblin:tmp matthew$ python -c "import rdflib.sparql.parser as foo; print foo.__file__"
/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/rdflib-2.4.2-py2.7-macosx-10.6-intel.egg/rdflib/sparql/parser.pyc
Well, I installed from your GitHub repo here, following the cues on your comment on https://github.com/RDFLib/FuXi/issues/1 and everything seems to work. Perhaps my confusion is in trying to understand what may be outdated documentation on the Google Code project wiki for FuXi. I'll leave this ticket open just to give you the chance to acknowledge what happened if you are interested in any more details, but feel free to close this out when you are ready. Thank you.
Hey, Matthew.
It's hard for me to say what the problem is. Unfortunately, I'm still using FuXi production with layercacke-python and this github project is a fork intended to address compatibility with the latest version of rdflib, which I still do not use primarily because of some drift that occurred some time back (that you may be aware of). When I try your import statements in my environment (using FuXi 1.4 production with layercacke), I get something similar:
$ python -c "import rdflib.sparql.parser as foo; print foo" <module 'rdflib.sparql.parser' from '/Users/chimezieogbuji/Projects/python-dlp-devel/trunk/layercake-python/rdflib/sparql/parser.pyc'>
$ python -c "import rdflib.sparql.parser as foo; print str(dir(foo))" ['ANON', 'ASC', 'ASK', 'AT', 'AdditiveExpression', 'ArgList', 'AskQuery', 'BASE', 'BLANK_NODE_LABEL', 'BNodeRef', 'BOUND', 'BY', 'BaseDecl', 'BlankNode', 'BooleanLiteral', 'BrackettedExpression', 'BuiltInCall', 'COLON', 'COMMA', 'CONSTRUCT', 'CaselessKeyword', 'Collection', 'Combine', 'ConditionalAndExpression', 'ConditionalOrExpression', 'Constraint', 'ConstructQuery', 'ConstructTemplate', 'DATATYPE', 'DEBUG', 'DESC', 'DESCRIBE', 'DISTINCT', 'DOUBLE_HAT', 'DatasetClause', 'DescribeQuery', 'EXPONENT_re', 'Empty', 'Expression', 'FILTER', 'FLOAT', 'FLOAT_re', 'FROM', 'Filter', 'Forward', 'FunctionCall', 'GRAPH', 'GT', 'GraphGraphPattern', 'GraphNode', 'GraphPattern', 'GraphPatternNotTriples', 'GraphTerm', 'Group', 'GroupGraphPattern', 'INT', 'INTEGER', 'INT_re', 'IRI', 'IRI_REF', 'IRIref', 'Keyword', 'LANG', 'LANGMATCHES', 'LANGTAG', 'LB', 'LC', 'LIMIT', 'LP', 'LT', 'LimitClause', 'Literal', 'MultiplicativeExpression', 'NAMED', 'NIL', 'NoMatch', 'NumericExpression', 'NumericLiteral', 'OFFSET', 'OPTIONAL', 'ORDER', 'ObjectList', 'OffsetClause', 'OneOrMore', 'Optional', 'OptionalGraphPattern', 'OrderClause', 'OrderCondition', 'PERIOD', 'PNAME_LN', 'PNAME_NS', 'PN_CHARS_BASE_re', 'PN_CHARS_U_re', 'PN_CHARS_re', 'PN_LOCAL', 'PN_PREFIX', 'PN_PREFIX_re', 'PREFIX', 'ParseElementEnhance', 'ParseException', 'ParseExpression', 'PrefixDecl', 'PrefixedName', 'PrimaryExpression', 'ProjectionMismatchException', 'Prologue', 'PropertyListItem', 'PropertyListNotEmpty', 'QM', 'Query', 'RB', 'RC', 'RDFLiteral', 'REGEX', 'RP', 'Regex', 'RegexExpression', 'RelationalExpression', 'SELECT', 'SEMICOLON', 'STR', 'SelectQuery', 'SkipTo', 'SolutionModifier', 'String', 'Suppress', 'TriplesBlock', 'TriplesNode', 'TriplesSameSubject', 'UNION', 'URIRef', 'USD', 'UnaryExpression', 'UnionGraphPattern', 'VARNAME', 'ValueLogical', 'Var', 'VarOrIRIref', 'VarOrTerm', 'Verb', 'WHERE', 'WS_re', 'WhereClause', 'XSD_NS', 'ZeroOrMore', 'builtins', 'doc', 'file', 'name', 'package', 'as_empty', 'base64', 'codepoint_re', 'col', 'components', 'composition', 'composition2', 'isBLANK', 'isIRI', 'isLITERAL', 'isURI', 'lineno', 'oneOf', 'parse', 'preprocess', 'quotedString', 'rdflib', 're', 'refer_component', 'regex_group', 'removeQuotes', 'restOfLine', 'sameTerm', 'setPropertyValueList', 'substitute_codepoint', 'sys']
What happens when you use "from rdflib.sparql.parser import parse" instead of the statements you used on the command-line?
-- Chime
On Sat, Jun 8, 2013 at 11:36 PM, Matthew A. Russell < [email protected]> wrote:
Hi - I'm trying to use the latest FuXi from a fresh virtualenv where I've installed rdflib and fuxi in a clean environment, and I'm getting the following error below. I've also included a couple of diagnostic python commands in case they're helpful. Perhaps this is just an issue related to my environment, but i'm not quite sure why it would be the case if I'm in a fresh environment and such a fundamental import is breaking FuXi from even starting. Any advice on what might be happening would be much appreciated.
$ FuXi --help Traceback (most recent call last): File "/Users/matthew/virtualenvs/test_fuxi/bin/FuXi", line 8, in
load_entry_point('FuXi==1.4.production', 'console_scripts', 'FuXi')() File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 318, in load_entry_point File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 2221, in load_entry_point File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 1954, in load File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/FuXi-1.4.production-py2.7.egg/FuXi/Rete/CommandLine.py", line 10, in from FuXi.LP.BackwardFixpointProcedure import BackwardFixpointProcedure File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/FuXi-1.4.production-py2.7.egg/FuXi/LP/BackwardFixpointProcedure.py", line 30, in from FuXi.SPARQL import EDBQuery, EDBQueryFromBodyIterator, ConjunctiveQueryMemoize File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/FuXi-1.4.production-py2.7.egg/FuXi/SPARQL/init.py", line 8, in from FuXi.Rete.Magic import AdornedUniTerm File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/FuXi-1.4.production-py2.7.egg/FuXi/Rete/Magic.py", line 39, in from rdflib.sparql.parser import parse ImportError: cannot import name parse (test_fuxi)Goblin:tmp matthew$ which FuXi /Users/matthew/virtualenvs/test_fuxi/bin/FuXi (test_fuxi)Goblin:tmp matthew$ python -c "import rdflib.sparql.parser as foo; print foo" <module 'rdflib.sparql.parser' from '/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/rdflib-2.4.2-py2.7-macosx-10.6-intel.egg/rdflib/sparql/parser.pyc'> (test_fuxi)Goblin:tmp matthew$ python -c "import rdflib.sparql.parser as foo; print str(dir(foo))"'GraphPattern', 'Optional', 'URIRef', 'Union', 'Where', '_StackManager', 'builtins', 'doc', 'file', 'loader', 'name', 'package', '_buildGraphPattern', '_buildQueryArgs', '_escape', '_escapeLiterals', '_findStatements', '_getStatements', '_listTypes', '_makeList', '_parseSelect', '_parseWhere', '_parser', '_resolveBase', '_resolvePrefixes', '_resolveShorthand', '_unescape', 'base64', 'doSPARQL', 're'Goblin:tmp matthew$ python -c "import rdflib.sparql.parser as foo; print foo.file" /Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/rdflib-2.4.2-py2.7-macosx-10.6-intel.egg/rdflib/sparql/parser.pyc — Reply to this email directly or view it on GitHubhttps://github.com/RDFLib/FuXi/issues/4 .
Chime - thanks for the response. I think I may have confused you in my initial message below. What I was trying to say in the first part of my message is that the initial error I was receiving was in a fresh virtualenv with nothing more than an "easy_install fuxi==1.4.production" in it, which led to that initial import error. In other words, it seems to be the case that whatever is on PyPI is giving me the problems. In that same environment, if I try the command you suggested, here's what happens:
$ python -c "from rdflib.sparql.parser import parse"
Traceback (most recent call last):
File "
However, if I go into a clean virtualenv and do a "pip install git+git://github.com/ptwobrussell/FuXi#egg=FuXi-ptwobrussell-github", I end up with a FuXi that seems to work as expected.
Does that make sense?
On Jun 10, 2013, at 9:55 PM, chimezie [email protected] wrote:
Hey, Matthew.
It's hard for me to say what the problem is. Unfortunately, I'm still using FuXi production with layercacke-python and this github project is a fork intended to address compatibility with the latest version of rdflib, which I still do not use primarily because of some drift that occurred some time back (that you may be aware of). When I try your import statements in my environment (using FuXi 1.4 production with layercacke), I get something similar:
$ python -c "import rdflib.sparql.parser as foo; print foo" <module 'rdflib.sparql.parser' from '/Users/chimezieogbuji/Projects/python-dlp-devel/trunk/layercake-python/rdflib/sparql/parser.pyc'>
$ python -c "import rdflib.sparql.parser as foo; print str(dir(foo))" ['ANON', 'ASC', 'ASK', 'AT', 'AdditiveExpression', 'ArgList', 'AskQuery', 'BASE', 'BLANK_NODE_LABEL', 'BNodeRef', 'BOUND', 'BY', 'BaseDecl', 'BlankNode', 'BooleanLiteral', 'BrackettedExpression', 'BuiltInCall', 'COLON', 'COMMA', 'CONSTRUCT', 'CaselessKeyword', 'Collection', 'Combine', 'ConditionalAndExpression', 'ConditionalOrExpression', 'Constraint', 'ConstructQuery', 'ConstructTemplate', 'DATATYPE', 'DEBUG', 'DESC', 'DESCRIBE', 'DISTINCT', 'DOUBLE_HAT', 'DatasetClause', 'DescribeQuery', 'EXPONENT_re', 'Empty', 'Expression', 'FILTER', 'FLOAT', 'FLOAT_re', 'FROM', 'Filter', 'Forward', 'FunctionCall', 'GRAPH', 'GT', 'GraphGraphPattern', 'GraphNode', 'GraphPattern', 'GraphPatternNotTriples', 'GraphTerm', 'Group', 'GroupGraphPattern', 'INT', 'INTEGER', 'INT_re', 'IRI', 'IRI_REF', 'IRIref', 'Keyword', 'LANG', 'LANGMATCHES', 'LANGTAG', 'LB', 'LC', 'LIMIT', 'LP', 'LT', 'LimitClause', 'Literal', 'MultiplicativeExpression', 'NAMED', 'NIL', 'NoMatch', 'NumericExpression', 'NumericLiteral', 'OFFSET', 'OPTIONAL', 'ORDER', 'ObjectList', 'OffsetClause', 'OneOrMore', 'Optional', 'OptionalGraphPattern', 'OrderClause', 'OrderCondition', 'PERIOD', 'PNAME_LN', 'PNAME_NS', 'PN_CHARS_BASE_re', 'PN_CHARS_U_re', 'PN_CHARS_re', 'PN_LOCAL', 'PN_PREFIX', 'PN_PREFIX_re', 'PREFIX', 'ParseElementEnhance', 'ParseException', 'ParseExpression', 'PrefixDecl', 'PrefixedName', 'PrimaryExpression', 'ProjectionMismatchException', 'Prologue', 'PropertyListItem', 'PropertyListNotEmpty', 'QM', 'Query', 'RB', 'RC', 'RDFLiteral', 'REGEX', 'RP', 'Regex', 'RegexExpression', 'RelationalExpression', 'SELECT', 'SEMICOLON', 'STR', 'SelectQuery', 'SkipTo', 'SolutionModifier', 'String', 'Suppress', 'TriplesBlock', 'TriplesNode', 'TriplesSameSubject', 'UNION', 'URIRef', 'USD', 'UnaryExpression', 'UnionGraphPattern', 'VARNAME', 'ValueLogical', 'Var', 'VarOrIRIref', 'VarOrTerm', 'Verb', 'WHERE', 'WS_re', 'WhereClause', 'XSD_NS', 'ZeroOrMore', 'builtins', 'doc', 'file', 'name', 'package', 'as_empty', 'base64', 'codepoint_re', 'col', 'components', 'composition', 'composition2', 'isBLANK', 'isIRI', 'isLITERAL', 'isURI', 'lineno', 'oneOf', 'parse', 'preprocess', 'quotedString', 'rdflib', 're', 'refer_component', 'regex_group', 'removeQuotes', 'restOfLine', 'sameTerm', 'setPropertyValueList', 'substitute_codepoint', 'sys']
What happens when you use "from rdflib.sparql.parser import parse" instead of the statements you used on the command-line?
-- Chime
On Sat, Jun 8, 2013 at 11:36 PM, Matthew A. Russell < [email protected]> wrote:
Hi - I'm trying to use the latest FuXi from a fresh virtualenv where I've installed rdflib and fuxi in a clean environment, and I'm getting the following error below. I've also included a couple of diagnostic python commands in case they're helpful. Perhaps this is just an issue related to my environment, but i'm not quite sure why it would be the case if I'm in a fresh environment and such a fundamental import is breaking FuXi from even starting. Any advice on what might be happening would be much appreciated.
$ FuXi --help Traceback (most recent call last): File "/Users/matthew/virtualenvs/test_fuxi/bin/FuXi", line 8, in
load_entry_point('FuXi==1.4.production', 'console_scripts', 'FuXi')() File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 318, in load_entry_point File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 2221, in load_entry_point File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 1954, in load File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/FuXi-1.4.production-py2.7.egg/FuXi/Rete/CommandLine.py", line 10, in from FuXi.LP.BackwardFixpointProcedure import BackwardFixpointProcedure File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/FuXi-1.4.production-py2.7.egg/FuXi/LP/BackwardFixpointProcedure.py", line 30, in from FuXi.SPARQL import EDBQuery, EDBQueryFromBodyIterator, ConjunctiveQueryMemoize File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/FuXi-1.4.production-py2.7.egg/FuXi/SPARQL/init.py", line 8, in from FuXi.Rete.Magic import AdornedUniTerm File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/FuXi-1.4.production-py2.7.egg/FuXi/Rete/Magic.py", line 39, in from rdflib.sparql.parser import parse ImportError: cannot import name parse (test_fuxi)Goblin:tmp matthew$ which FuXi /Users/matthew/virtualenvs/test_fuxi/bin/FuXi (test_fuxi)Goblin:tmp matthew$ python -c "import rdflib.sparql.parser as foo; print foo" <module 'rdflib.sparql.parser' from '/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/rdflib-2.4.2-py2.7-macosx-10.6-intel.egg/rdflib/sparql/parser.pyc'> (test_fuxi)Goblin:tmp matthew$ python -c "import rdflib.sparql.parser as foo; print str(dir(foo))"'GraphPattern', 'Optional', 'URIRef', 'Union', 'Where', '_StackManager', 'builtins', 'doc', 'file', 'loader', 'name', 'package', '_buildGraphPattern', '_buildQueryArgs', '_escape', '_escapeLiterals', '_findStatements', '_getStatements', '_listTypes', '_makeList', '_parseSelect', '_parseWhere', '_parser', '_resolveBase', '_resolvePrefixes', '_resolveShorthand', '_unescape', 'base64', 'doSPARQL', 're'Goblin:tmp matthew$ python -c "import rdflib.sparql.parser as foo; print foo.file" /Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/rdflib-2.4.2-py2.7-macosx-10.6-intel.egg/rdflib/sparql/parser.pyc — Reply to this email directly or view it on GitHubhttps://github.com/RDFLib/FuXi/issues/4 .
— Reply to this email directly or view it on GitHub.
On Mon, Jun 10, 2013 at 11:05 PM, Matthew A. Russell < [email protected]> wrote:
Chime - thanks for the response. I think I may have confused you in my initial message below. What I was trying to say in the first part of my message is that the initial error I was receiving was in a fresh virtualenv with nothing more than an "easy_install fuxi==1.4.production" in it, which led to that initial import error. In other words, it seems to be the case that whatever is on PyPI is giving me the problems. In that same environment, if I try the command you suggested, here's what happens:
$ python -c "from rdflib.sparql.parser import parse" Traceback (most recent call last): File "
", line 1, in ImportError: cannot import name parse However, if I go into a clean virtualenv and do a "pip install git+git:// github.com/ptwobrussell/FuXi#egg=FuXi-ptwobrussell-github", I end up with a FuXi that seems to work as expected.
Does that make sense?
Yes, and thanks for clarifying. See the link below describing changes I have made to FuXi and a new, minor release that addresses the installation issues and now depends completely on pip for the installation of FuXi. I believe this addresses the problem, but let me know if there are still outstanding issues:
https://groups.google.com/forum/?fromgroups#!topic/fuxi-discussion/x_fZn7V0kPM
-- Chime
@ptwobrussell - sorry for any confusion that I've caused you. If you want to use FuXi (as opposed to work on the port), then you should follow Chimezie's recommendations and use it with the "layercake-cake" support package.
The code in this repos (https://github.com/RDFLib/FuXi) no longer functions with RDFLib 4 and was only included in the github RDFLib org space as a convenience for anyone interested in contributing to a port.
The code's presence here is now clearly a source of confusion, so I will remove the repos from the RDFLib org collection (I'll allow a few days for this discussion to subside).
Cheers,
Graham.