1

I install spacy on a Jupyter notebook Python 3, with Windows 10, and then try to install the English language model.

import spacy
!python -m spacy download en

The latter command givest me the following error:

Traceback (most recent call last):
  File "C:\Users\naimb\Anaconda3\lib\runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "C:\Users\naimb\Anaconda3\lib\runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "C:\Users\naimb\Anaconda3\lib\runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "C:\Users\naimb\Anaconda3\lib\site-packages\spacy\__init__.py", line 12, in <module>
    from .cli.info import info as cli_info
  File "C:\Users\naimb\Anaconda3\lib\site-packages\spacy\cli\__init__.py", line 6, in <module>
    from .train import train  # noqa: F401
  File "C:\Users\naimb\Anaconda3\lib\site-packages\spacy\cli\train.py", line 17, in <module>
    from ..gold import GoldCorpus
  File "morphology.pxd", line 13, in init spacy.gold
  File "vocab.pxd", line 27, in init spacy.morphology
  File "vocab.pyx", line 20, in init spacy.vocab
  File "C:\Users\naimb\Anaconda3\lib\site-packages\spacy\lemmatizer.py", line 8, in <module>
    from .lookups import Lookups
  File "C:\Users\naimb\Anaconda3\lib\site-packages\spacy\lookups.py", line 6, in <module>
    from preshed.bloom import BloomFilter
ModuleNotFoundError: No module named 'preshed.bloom'

What's the preshed.bloom module? Following the answer in this question, I loaded the preshed wheel from this page (preshed‑3.0.2‑cp38‑cp38‑win_amd64.whl), but the problem remains.

Does anyone know how to fix this problem?

NBK
  • 887
  • 9
  • 20

1 Answers1

6

This is probably a version mismatch in one of spacy's dependencies. You shouldn't need to download wheels from a third-party site, installing with pip (or conda) should just work.

You can try pip install -U spacy in your current environment to update all the dependencies or if that doesn't help, try installing spacy from scratch in a new virtual environment.

(The answer you linked is a bit out-of-date, but as mentioned in the other answers, spacy only works with 64-bit python, so double-check that, too.)

aab
  • 10,858
  • 22
  • 38