mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 17:06:29 +03:00
Check if spaCy has compiled correctly and show error message
This commit is contained in:
parent
e5f47cd82d
commit
3463ded7cf
|
@ -1,10 +1,17 @@
|
||||||
# coding: utf8
|
# coding: utf8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from .errors import Errors, Warnings, deprecation_warning
|
||||||
|
|
||||||
|
try:
|
||||||
|
# check if spaCy has compiled correctly (if it hasn't this will raise)
|
||||||
|
import spacy.symbols
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
raise ImportError(Errors.E094)
|
||||||
|
|
||||||
from .cli.info import info as cli_info
|
from .cli.info import info as cli_info
|
||||||
from .glossary import explain
|
from .glossary import explain
|
||||||
from .about import __version__
|
from .about import __version__
|
||||||
from .errors import Warnings, deprecation_warning
|
|
||||||
from . import util
|
from . import util
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -244,6 +244,10 @@ class Errors(object):
|
||||||
"Alternatively, it is built from the 'lang' and 'name' keys in "
|
"Alternatively, it is built from the 'lang' and 'name' keys in "
|
||||||
"the meta.json. Vector names are required to avoid issue #1660.")
|
"the meta.json. Vector names are required to avoid issue #1660.")
|
||||||
E093 = ("token.ent_iob values make invalid sequence: I without B\n{seq}")
|
E093 = ("token.ent_iob values make invalid sequence: I without B\n{seq}")
|
||||||
|
E094 = ("Can't import from compiled modules. This usually indicates that "
|
||||||
|
"spaCy hasn't compiled correcty. If you're on Windows, make sure "
|
||||||
|
"you have a compiler, i.e. the Visual C++ Build Tools installed. "
|
||||||
|
"See the installation docs for more info: https://spacy.io/usage/")
|
||||||
|
|
||||||
|
|
||||||
@add_codes
|
@add_codes
|
||||||
|
|
Loading…
Reference in New Issue
Block a user