interrogator / buzz

linguistics backend
MIT License
40 stars 3 forks source link

can only run as admin? #4

Closed l0rb closed 4 years ago

l0rb commented 4 years ago

Following the documentation I have run into an error when trying to parse the corpus. The stacktrace seems to suggest that this needs admin privileges to run? Is there something inside of buzz that could be changed so this works out-of-the-box without being admin?

>>> p = c.parse()
Collecting en_core_web_sm==2.1.0 from https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.1.0/en_core_web_sm-2.1.0.tar.gz#egg=en_core_web_sm==2.1.0
  Downloading https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.1.0/en_core_web_sm-2.1.0.tar.gz (11.1MB)
    100% |████████████████████████████████| 11.1MB 31.5MB/s 
Installing collected packages: en-core-web-sm
  Running setup.py install for en-core-web-sm ... done
Successfully installed en-core-web-sm-2.1.0
✔ Download and installation successful
You can now load the model via spacy.load('en_core_web_sm')
⚠ Download successful but linking failed
Creating a shortcut link for 'en' didn't work (maybe you don't have admin
permissions?), but you can still load the model via its full package name: nlp =
spacy.load('en_core_web_sm')
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/buzz/utils.py", line 134, in _get_nlp
    return spacy.load(lang)
  File "/usr/local/lib/python3.7/dist-packages/spacy/__init__.py", line 27, in load
    return util.load_model(name, **overrides)
  File "/usr/local/lib/python3.7/dist-packages/spacy/util.py", line 139, in load_model
    raise IOError(Errors.E050.format(name=name))
OSError: [E050] Can't find model 'en'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/dist-packages/buzz/corpus.py", line 190, in parse
    self.parser = Parser(cons_parser=cons_parser, language=language)
  File "/usr/local/lib/python3.7/dist-packages/buzz/parse.py", line 79, in __init__
    self.nlp = _get_nlp(language=language)
  File "/usr/local/lib/python3.7/dist-packages/buzz/utils.py", line 139, in _get_nlp
    return spacy.load(lang)
  File "/usr/local/lib/python3.7/dist-packages/spacy/__init__.py", line 27, in load
    return util.load_model(name, **overrides)
  File "/usr/local/lib/python3.7/dist-packages/spacy/util.py", line 139, in load_model
    raise IOError(Errors.E050.format(name=name))
OSError: [E050] Can't find model 'en'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.
interrogator commented 4 years ago

Here spaCy is failing to link the model name to short name 'en'. It's a problem on their side IMO, but I think I can work around it by specifying the full name in buzz, as it suggests. Quickfixed here: https://github.com/interrogator/buzz/commit/de98a64d00a85a59c4c8d12932723f081b4c7abd

interrogator commented 4 years ago

Please try again with latest master and close if fixed

l0rb commented 4 years ago

this works with the quickfix.