Amanda Azari
Amanda Azari

Reputation: 11

ImportError: DLL load failed while importing strings: The specified module could not be found

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?

Upvotes: 0

Views: 3953

Answers (2)

Hanoun Fouad
Hanoun Fouad

Reputation: 85

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!

Upvotes: 4

sophros
sophros

Reputation: 16620

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.

Upvotes: 0

Related Questions