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

Windows .pyd files sneakily depend on msvcp140.dll #5332

Open
gthb opened this issue Apr 21, 2020 · 3 comments
Open

Windows .pyd files sneakily depend on msvcp140.dll #5332

gthb opened this issue Apr 21, 2020 · 3 comments
Labels
help wanted Contributions welcome! install Installation issues windows Issues related to Windows

Comments

@gthb
Copy link

gthb commented Apr 21, 2020

How to reproduce the problem

Start with a vanilla Windows 10 machine that doesn't have the Microsoft Visual C++ Redistributable installed, and in particular doesn't have msvcp140.dll in C:\Windows\system32.

(Yeah, this already feels unpleasant, I know, sorry.)

Install a 64-bit Python from python.org, and with that in path, in cmd.exe

python -m venv venv
pip install spacy
python -m "import spacy"

This fails:

(venv) C:\Users\gbr\Desktop\foo>python -c "import spacy"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\gbr\Desktop\foo\venv\lib\site-packages\spacy\__init__.py", line 12, in <module>
    from . import pipeline
  File "C:\Users\gbr\Desktop\foo\venv\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.

The reason appears to be that lots of Spacy's .pyd files (DLLs) depend on msvcp140.dll, which (unlike vcruntime140.dll) is not shipped with Python and not present in Windows by default.

Spacy could bundle this DLL, like I notice scipy is doing, see MacPython/scipy-wheels#13 ... or, failing that, it could document that anyone deploying an app on Windows with spacy bundled inside (I'm doing that using pyinstaller) will need to arrange for msvcp140.dll to be installed as well.

Your Environment

  • Operating System: Windows 10
  • Python Version Used: 3.7.7
  • spaCy Version Used: 2.2.4
  • Environment Information:
@svlandeg svlandeg added install Installation issues windows Issues related to Windows labels Apr 21, 2020
@honnibal
Copy link
Member

Thanks for writing this up, it's a very helpful explanation that's sure to save us time.

@honnibal
Copy link
Member

Okay we have it on good authority that bundling the DLL is the right thing: https://twitter.com/honnibal/status/1263388610021203968 . So we need to add that to our build process somehow. Possibly in https://github.com/explosion/wheelwright ?

@gthb
Copy link
Author

gthb commented May 21, 2020

Yes, at a glance that seems like the place!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Contributions welcome! install Installation issues windows Issues related to Windows
Projects
None yet
Development

No branches or pull requests

3 participants