0

I am trying to load a language model in spaCy, but I get errors when I try to install the model, both in the legacy command and the newer command.

Installing via the legacy shortname:

python -m spacy download en
Traceback (most recent call last):
  File "C:\Users\mikkelson\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 188, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "C:\Users\mikkelson\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 147, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "C:\Users\mikkelson\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "C:\Users\mikkelson\AppData\Local\Programs\Python\Python39\lib\site-packages\spacy\__init__.py", line 13, in <module>
    from . import pipeline  # noqa: F401
  File "C:\Users\mikkelson\AppData\Local\Programs\Python\Python39\lib\site-packages\spacy\pipeline\__init__.py", line 1, in <module>
    from .attributeruler import AttributeRuler
  File "C:\Users\mikkelson\AppData\Local\Programs\Python\Python39\lib\site-packages\spacy\pipeline\attributeruler.py", line 6, in <module>
    from .pipe import Pipe
  File "spacy\pipeline\pipe.pyx", line 1, in init spacy.pipeline.pipe
ImportError: DLL load failed while importing strings: The specified module could not be found.

Installing using the newer full name:

python -m spacy download en_core_web_sm
Traceback (most recent call last):
  File "C:\Users\mikkelson\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 188, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "C:\Users\mikkelson\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 147, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "C:\Users\mikkelson\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "C:\Users\mikkelson\AppData\Local\Programs\Python\Python39\lib\site-packages\spacy\__init__.py", line 13, in <module>
    from . import pipeline  # noqa: F401
  File "C:\Users\mikkelson\AppData\Local\Programs\Python\Python39\lib\site-packages\spacy\pipeline\__init__.py", line 1, in <module>
    from .attributeruler import AttributeRuler
  File "C:\Users\mikkelson\AppData\Local\Programs\Python\Python39\lib\site-packages\spacy\pipeline\attributeruler.py", line 6, in <module>
    from .pipe import Pipe
  File "spacy\pipeline\pipe.pyx", line 1, in init spacy.pipeline.pipe
ImportError: DLL load failed while importing strings: The specified module could not be found.

Python 3.9 is installed via anaconda, spaCy v 3.0.6 is installed via pip, and I'm in Windows environment. How can I fix this?

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
Amanda Azari
  • 11
  • 1
  • 2

2 Answers2

4

Been facing the same issue, was told problem comes from python3.9 so i tested with 3.8 and this didn't help however installing the following Visual C++ Redistributable solved my problem https://www.microsoft.com/en-in/download/details.aspx?id=48145

I hope that helps!

0

The issue is not related to particular way you attempt to download models but rather to an issue with loading DLL (pipe.pyx) which is very likely to have a dependency on VS Build Tools that you are missing (see details here).

Once you install this dependency, it should start working.

sophros
  • 14,672
  • 11
  • 46
  • 75
  • I'm not using Visual Studio, I'm using pycharm. Any suggestions for that instead? I see the details on how to get a DLL from winpython, but I don't know how to tell which DLL I need. Thanks! – Amanda Azari Jul 06 '21 at 17:45
  • It is not about the IDE but the runtime libraries that are needed to be installed on Windows (because they are dependencies of the natively-compiled SpaCy libraries). – sophros Jul 06 '21 at 18:29