简体   繁体   中英

ImportError: [E048] Can't import language en from spacy.lang: No module named 'spacy.matcher' How do i fix this?

the title says all mostly, i'e been trying to make this package named chatterbot to work and then it shows this, i'm running ubuntu focal fossa

Full error log:

<frozen importlib._bootstrap>:219: RuntimeWarning: thinc.extra.search.Beam size changed, may indicate binary incompatibility. Expected 112 from C header, got 120 from PyObject
Traceback (most recent call last):
  File "/home/arman/.local/lib/python3.8/site-packages/spacy/util.py", line 70, in get_lang_class
    module = importlib.import_module(".lang.%s" % lang, "spacy")
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/arman/.local/lib/python3.8/site-packages/spacy/lang/en/__init__.py", line 15, in <module>
    from ...language import Language
  File "/home/arman/.local/lib/python3.8/site-packages/spacy/language.py", line 17, in <module>
    from .pipeline import DependencyParser, Tagger
  File "/home/arman/.local/lib/python3.8/site-packages/spacy/pipeline/__init__.py", line 4, in <module>
    from .pipes import Tagger, DependencyParser, EntityRecognizer, EntityLinker
  File "pipes.pyx", line 17, in init spacy.pipeline.pipes
  File "/home/arman/.local/lib/python3.8/site-packages/spacy/pipeline/functions.py", line 4, in <module>
    from ..matcher import Matcher
ModuleNotFoundError: No module named 'spacy.matcher'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 4, in <module>
    bot = ChatBot('Test')
  File "/usr/local/lib/python3.8/dist-packages/ChatterBot-1.1.0a7-py3.8.egg/chatterbot/chatterbot.py", line 28, in __init__
  File "/usr/local/lib/python3.8/dist-packages/ChatterBot-1.1.0a7-py3.8.egg/chatterbot/utils.py", line 33, in initialize_class
  File "/usr/local/lib/python3.8/dist-packages/ChatterBot-1.1.0a7-py3.8.egg/chatterbot/storage/sql_storage.py", line 20, in __init__
  File "/usr/local/lib/python3.8/dist-packages/ChatterBot-1.1.0a7-py3.8.egg/chatterbot/storage/storage_adapter.py", line 22, in __init__
  File "/usr/local/lib/python3.8/dist-packages/ChatterBot-1.1.0a7-py3.8.egg/chatterbot/tagging.py", line 26, in __init__
  File "/home/arman/.local/lib/python3.8/site-packages/spacy/__init__.py", line 27, in load
    return util.load_model(name, **overrides)
  File "/home/arman/.local/lib/python3.8/site-packages/spacy/util.py", line 132, in load_model
    return load_model_from_link(name, **overrides)
  File "/home/arman/.local/lib/python3.8/site-packages/spacy/util.py", line 149, in load_model_from_link
    return cls.load(**overrides)
  File "/home/arman/.local/lib/python3.8/site-packages/spacy/data/en/__init__.py", line 12, in load
    return load_model_from_init_py(__file__, **overrides)
  File "/home/arman/.local/lib/python3.8/site-packages/spacy/util.py", line 196, in load_model_from_init_py
    return load_model_from_path(data_path, meta, **overrides)
  File "/home/arman/.local/lib/python3.8/site-packages/spacy/util.py", line 166, in load_model_from_path
    cls = get_lang_class(lang)
  File "/home/arman/.local/lib/python3.8/site-packages/spacy/util.py", line 72, in get_lang_class
    raise ImportError(Errors.E048.format(lang=lang, err=err))
ImportError: [E048] Can't import language en from spacy.lang: No module named 'spacy.matcher'

I've tried all the other solutions on the internet none of them worked, it's been so many hours i don't even remember them all please forgive me

I don't Know what just happened or what was the problem but i fixed it, in case anyone encounters the issue i'll leave it here

  1. Get spacy from github
  2. Install everything on the requirements file
  3. Install spacy from source
  4. It's fixed somehow...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM