Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: DLL load failed: The specified module could not be found. #5217

Closed
KarlHC opened this issue Mar 27, 2020 · 7 comments
Closed

ImportError: DLL load failed: The specified module could not be found. #5217

KarlHC opened this issue Mar 27, 2020 · 7 comments
Labels
install Installation issues more-info-needed This issue needs more information

Comments

@KarlHC
Copy link

KarlHC commented Mar 27, 2020

How to reproduce the behaviour

When running my python script in a Docker container on Windows, I get the following error when importing spacy :

Traceback (most recent call last):
  File "application.py", line 5, in <module>
    import spacy
  File "C:\Python\lib\site-packages\spacy\__init__.py", line 12, in <module>
    from . import pipeline
  File "C:\Python\lib\site-packages\spacy\pipeline\__init__.py", line 4, in <module>
    from .pipes import Tagger, DependencyParser, EntityRecognizer, EntityLinker
  File "pipes.pyx", line 1, in init spacy.pipeline.pipes
ImportError: DLL load failed: The specified module could not be found.

Exactly the same issue has been described before, see #4733, albeit not running in Docker

When I execute the same script on the host computer, it runs fine (same python and spacy versions as in the container)

Environment

  • Operating System: Windows Server 2016
  • Python Version Used: 3.7.5
  • spaCy Version Used: 2.2.4
  • Environment Information:
@svlandeg svlandeg added the install Installation issues label Mar 28, 2020
@svlandeg
Copy link
Member

svlandeg commented Apr 15, 2020

This usually points to the fact that spaCy was not installed properly (as in the cited thread), or perhaps there are some conflicting packages.

From your output, it looks like you're not working in a virtual environment, which I would definitely recommend. So I would advice to create an entirely new venv, then install spaCy again from scratch.

If it doesn't work, can you share the full install logs?

@svlandeg svlandeg added the more-info-needed This issue needs more information label Apr 15, 2020
@no-response
Copy link

no-response bot commented Apr 29, 2020

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.

@no-response no-response bot closed this as completed Apr 29, 2020
@KarlHC
Copy link
Author

KarlHC commented May 7, 2020

Hallo uit Gent! ;-)

Sorry for the late response, but I'm still struggling with installing spacy in a windows docker container.

I tried your suggestion by creating a virtual environment, but the issue remains the same...
I realize you may not be a docker expert (and me neither), but this is my Docker file:

FROM python-3-7-5-base

EXPOSE 8000

CMD python -m venv spacy-env

WORKDIR /spacy-env
ADD . /spacy-env

CMD ./Scripts/activate.bat

RUN pip install -r requirements.txt

RUN pip install -U spacy-lookups-data 
RUN pip install -U lemminflect 
RUN pip install -U spacy_iwnlp 
RUN pip install -U spacy_lefff

CMD python application.py

The python-3-7-5-base is just a base image for python in a windows server 2016 container.

The requirements.txt file:

hug>=2.4.0,<2.5.0
hug-middleware-cors>=1.0.0,<2.0.0
spacy>=2.2.2,<2.3.0
waitress>=1.0.2,<2.0.0

https://github.com/explosion/spacy-models/releases/download/en_core_web_lg-2.2.5/en_core_web_lg-2.2.5.tar.gz#egg=en_core_web_lg==2.2.5
https://github.com/explosion/spacy-models/releases/download/de_core_news_md-2.2.5/de_core_news_md-2.2.5.tar.gz#egg=de_core_news_md==2.2.5
https://github.com/explosion/spacy-models/releases/download/fr_core_news_md-2.2.5/fr_core_news_md-2.2.5.tar.gz#egg=fr_core_news_md==2.2.5
https://github.com/explosion/spacy-models/releases/download/nl_core_news_sm-2.2.5/nl_core_news_sm-2.2.5.tar.gz#egg=nl_core_news_sm==2.2.5

The container builds ok, but when I run it I get the error in my original post.

Any help much appreciated!

@no-response no-response bot removed the more-info-needed This issue needs more information label May 7, 2020
@no-response no-response bot reopened this May 7, 2020
@svlandeg
Copy link
Member

svlandeg commented May 8, 2020

After installing it like this, what is the error you're getting?

If it's exactly the same, the code is not running in the virtual environment. In that case, you need to check your settings and check which python etc and ensure it's properly run in your new, clean environment.

If it's different than your original post, could you paste the full stack trace?

@svlandeg svlandeg added the more-info-needed This issue needs more information label May 8, 2020
@no-response
Copy link

no-response bot commented May 22, 2020

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.

@no-response no-response bot closed this as completed May 22, 2020
@lock
Copy link

lock bot commented Jun 24, 2020

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.

1 similar comment
@lock
Copy link

lock bot commented Jun 24, 2020

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.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
install Installation issues more-info-needed This issue needs more information
Projects
None yet
Development

No branches or pull requests

2 participants