Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FuXi==1.4.production fails on "from rdflib.sparql.parser import parse" - ImportError: cannot import name parse #4

Open
ptwobrussell opened this issue Jun 9, 2013 · 5 comments

Comments

@ptwobrussell
Copy link

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
@ptwobrussell
Copy link
Author

Well, I installed from your GitHub repo here, following the cues on your comment on #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.

@chimezie
Copy link
Member

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 <
notifications@github.com> 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//issues/4
.

@ptwobrussell
Copy link
Author

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?

On Jun 10, 2013, at 9:55 PM, chimezie notifications@github.com 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 <
notifications@github.com> 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//issues/4
.


Reply to this email directly or view it on GitHub.

@chimezie
Copy link
Member

On Mon, Jun 10, 2013 at 11:05 PM, Matthew A. Russell <
notifications@github.com> 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

@ghost
Copy link

ghost commented Jun 12, 2013

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants