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

78 views
Skip to first unread message

ptwobr...@gmail.com

unread,
Jun 10, 2013, 1:46:09 PM6/10/13
to fuxi-discussion
Hello -

I just wanted to see if anyone could comment on an issue that I think may exist with FuXi==1.4.production. I've outlined the details here < https://github.com/RDFLib/FuXi/issues/4 >. Basically, the code doesn't seem to work with RDFLib 2.4.2 as advertised due to an import error, and I just wanted to see if this is a bona fide bug that I should log, or if I may be doing something wrong. (I feel as though I might be, though it isn't obvious.) 

I can workaround the problem by forking https://github.com/RDFLib/FuXi and doing a standard install from that frozen codebase but for my particular purposes, it would be nice to just "easy_install FuXi==1.4.production" and leave it at that. My primary concern is in making it as simple and straightforward as possible to install FuXi, since I'm writing some documentation for others to follow.

Any thoughts or advice?

I"ll include some extra output here just to show some extra steps I've taken to try and get this to work as I think the instructions outline in the Google Code wiki:

##############################
# Make sure that rdflib isn't installed at all
##############################

$ pip uninstall rdflib
Uninstalling rdflib:
  /Users/matthew/virtualenvs/test_fuxi/bin/rdfpipe
  /Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/rdflib-2.4.2-py2.7-macosx-10.6-intel.egg
Proceed (y/n)? y
  Successfully uninstalled rdflib
(test_fuxi)Goblin:mtsw2e-github matthew$ FuXi 
Traceback (most recent call last):
  File "/Users/matthew/virtualenvs/test_fuxi/bin/FuXi", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 2603, in <module>
  File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 666, in require
  File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 565, in resolve
pkg_resources.DistributionNotFound: rdflib<3a

##############################
# Try to install FuXi
##############################


(test_fuxi)Goblin:mtsw2e-github matthew$ easy_install -U FuXi==1.4.production
Searching for FuXi==1.4.production
Best match: FuXi 1.4.production
Processing FuXi-1.4.production-py2.7.egg
FuXi 1.4.production is already the active version in easy-install.pth
Installing FuXi script to /Users/matthew/virtualenvs/test_fuxi/bin

Using /Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/FuXi-1.4.production-py2.7.egg
Processing dependencies for FuXi==1.4.production
Searching for rdflib<3a
Best match: rdflib 2.4.2
Processing rdflib-2.4.2.tar.gz
Running rdflib-2.4.2/setup.py -q bdist_egg --dist-dir /var/folders/j2/93ckx33j6ls27v99p52x44j40000gn/T/easy_install-sWw7nc/rdflib-2.4.2/egg-dist-tmp-NpQxrE
warning: no files found matching 'example.py'
gcc-4.2 not found, using clang instead
src/bison/SPARQLParser.c:10506:15: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
              lexer->position - PyUnicode_AS_UNICODE(lexer->text));
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/bison/SPARQLParser.c:1619:67: note: expanded from macro 'REGEX_TRACE'
#define REGEX_TRACE(...) if (self->verbose > 1) PySys_WriteStderr(__VA_ARGS__)
                                                                  ^
1 warning generated.
zip_safe flag not set; analyzing archive contents...
Adding rdflib 2.4.2 to easy-install.pth file
Installing rdfpipe script to /Users/matthew/virtualenvs/test_fuxi/bin

Installed /Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/rdflib-2.4.2-py2.7-macosx-10.6-intel.egg
Finished processing dependencies for FuXi==1.4.production

##############################
# Try to run FuXi
##############################


(test_fuxi)Goblin:mtsw2e-github matthew$ FuXi 
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


For what it's worth, at the risk of conflating another issue, when I try to go through the steps to use layercake and get it to build, I end up encountering another error:

###########################
# Try to build layercake-python
###########################

(test_fuxi)Goblin:layercake-python matthew$ python setup.py install
Traceback (most recent call last):
  File "setup.py", line 9, in <module>
    from rdflib import __version__, __date__
  File "/private/tmp/python-dlp/layercake-python/rdflib/__init__.py", line 41, in <module>
    from rdflib.sparql.parser import parse as PyParseSPARQL
  File "/private/tmp/python-dlp/layercake-python/rdflib/sparql/parser.py", line 117, in <module>
    from pyparsing import (Regex, Suppress, Combine, Optional, CaselessKeyword,
ImportError: No module named pyparsing

###########################
# Try to install pyparsing
###########################

(test_fuxi)Goblin:layercake-python matthew$ easy_install pyparsing
Searching for pyparsing
Best match: pyparsing 2.0.0
Processing download
Running pyparsing-2.0.0/setup.py -q bdist_egg --dist-dir /var/folders/j2/93ckx33j6ls27v99p52x44j40000gn/T/easy_install-UyXVNF/pyparsing-2.0.0/egg-dist-tmp-7Wsmbn
Traceback (most recent call last):
  File "/Users/matthew/virtualenvs/test_fuxi/bin/easy_install", line 8, in <module>
    load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')()
  File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 1712, in main
  File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 1700, in with_ei_usage
  File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 1716, in <lambda>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 211, in run
  File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 446, in easy_install
  File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 476, in install_item
  File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 655, in install_eggs
  File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 930, in build_and_install
  File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 919, in run_setup
  File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/sandbox.py", line 62, in run_setup
  File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/sandbox.py", line 105, in run
  File "/Users/matthew/virtualenvs/test_fuxi/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/sandbox.py", line 64, in <lambda>
  File "setup.py", line 9, in <module>
    from rdflib import __version__, __date__
  File "/var/folders/j2/93ckx33j6ls27v99p52x44j40000gn/T/easy_install-UyXVNF/pyparsing-2.0.0/pyparsing.py", line 629
    nonlocal limit,foundArity
                 ^
SyntaxError: invalid syntax

########################
# Really?
########################

At any rate, I point these things out only to suggest that others may encounter similar problems. I think FuXi is a great project, and just wanted to make everyone aware that there may be some pain involved in getting it up and running. I would consider myself fairly Python savvy, but am running out of patience, and had it not been for the GitHub repo mentioned above, would probably have given up by now.

Thanks for any help.

Reply all
Reply to author
Forward
0 new messages