explosion / spaCy

💫 Industrial-strength Natural Language Processing (NLP) in Python
https://spacy.io
MIT License
30.09k stars 4.4k forks source link

AttributeError (no __reduce_cython__) while loading "en_core_web_sm" #4571

Closed DSLituiev closed 4 years ago

DSLituiev commented 5 years ago

How to reproduce the behaviour

import spacy
nlp = spacy.load("en_core_web_sm")

Error:

-----------------------------------------------------------------------
AttributeError                        Traceback (most recent call last)
<ipython-input-142-e49198ee6ee6> in <module>
      2 
      3 
----> 4 nlp = spacy.load("en_core_web_sm")
      5 
      6 from negspacy.negation import Negex

/Applications/anaconda3/envs/nlp/lib/python3.7/site-packages/spacy/__init__.py in load(name, **overrides)
     19 if sys.maxunicode == 65535:
     20     raise SystemError(Errors.E130)
---> 21 
     22 
     23 def load(name, **overrides):

/Applications/anaconda3/envs/nlp/lib/python3.7/site-packages/spacy/util.py in load_model(name, **overrides)
    112     RETURNS: Path or original argument.
    113     """
--> 114     if isinstance(path, basestring_):
    115         return Path(path)
    116     else:

/Applications/anaconda3/envs/nlp/lib/python3.7/site-packages/spacy/util.py in load_model_from_package(name, **overrides)
    133         if is_package(name):  # installed as package
    134             return load_model_from_package(name, **overrides)
--> 135         if Path(name).exists():  # path to model data directory
    136             return load_model_from_path(Path(name), **overrides)
    137     elif hasattr(name, "exists"):  # Path or Path-like to model data

/Applications/anaconda3/envs/nlp/lib/python3.7/site-packages/en_core_web_sm/__init__.py in load(**overrides)
     10 
     11 def load(**overrides):
---> 12     return load_model_from_init_py(__file__, **overrides)

/Applications/anaconda3/envs/nlp/lib/python3.7/site-packages/spacy/util.py in load_model_from_init_py(init_file, **overrides)
    171         pipeline = nlp.Defaults.pipe_names
    172     elif pipeline in (False, None):
--> 173         pipeline = []
    174     for name in pipeline:
    175         if name not in disable:

/Applications/anaconda3/envs/nlp/lib/python3.7/site-packages/spacy/util.py in load_model_from_path(model_path, meta, **overrides)
    141 
    142 def load_model_from_link(name, **overrides):
--> 143     """Load a model from a shortcut link, or directory in spaCy data path."""
    144     path = get_data_path() / name / "__init__.py"
    145     try:

/Applications/anaconda3/envs/nlp/lib/python3.7/site-packages/spacy/util.py in get_lang_class(lang)
     48 
     49     lang (unicode): Two-letter language code, e.g. 'en'.
---> 50     RETURNS (bool): Whether a Language class has been loaded.
     51     """
     52     global LANGUAGES

/Applications/anaconda3/envs/nlp/lib/python3.7/importlib/__init__.py in import_module(name, package)
    125                 break
    126             level += 1
--> 127     return _bootstrap._gcd_import(name[level:], package, level)
    128 
    129 

/Applications/anaconda3/envs/nlp/lib/python3.7/importlib/_bootstrap.py in _gcd_import(name, package, level)

/Applications/anaconda3/envs/nlp/lib/python3.7/importlib/_bootstrap.py in _find_and_load(name, import_)

/Applications/anaconda3/envs/nlp/lib/python3.7/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

/Applications/anaconda3/envs/nlp/lib/python3.7/importlib/_bootstrap.py in _load_unlocked(spec)

/Applications/anaconda3/envs/nlp/lib/python3.7/importlib/_bootstrap_external.py in exec_module(self, module)

/Applications/anaconda3/envs/nlp/lib/python3.7/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)

/Applications/anaconda3/envs/nlp/lib/python3.7/site-packages/spacy/lang/en/__init__.py in <module>
     13 from ..tokenizer_exceptions import BASE_EXCEPTIONS
     14 from ..norm_exceptions import BASE_NORMS
---> 15 from ...language import Language
     16 from ...attrs import LANG, NORM
     17 from ...util import update_exc, add_lookups

/Applications/anaconda3/envs/nlp/lib/python3.7/site-packages/spacy/language.py in <module>
     12 import srsly
     13 
---> 14 from .tokenizer import Tokenizer
     15 from .vocab import Vocab
     16 from .lemmatizer import Lemmatizer

/Applications/anaconda3/envs/nlp/lib/python3.7/site-packages/spacy/tokenizer.cpython-37m-darwin.so in init spacy.tokenizer()

AttributeError: type object 'spacy.tokenizer.array' has no attribute '__reduce_cython__'

Your Environment

ines commented 5 years ago

This error ususally happens if you have stale compiled artifacts in your installation. Is it possible that your environment had spaCy pre-installed (e.g. if you're using the Anaconda distribution)? And can you try again with a clean environment?

no-response[bot] commented 4 years ago

This issue has been automatically closed because there has been no response to a request for more information from the original author. With only the information that is currently in the issue, there's not enough information to take action. If you're the original author, feel free to reopen the issue if you have or find the answers needed to investigate further.

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.