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] Running on Python 3.5/3.6 requires msvcp140.dll which apparently isn't shipped by Python #359

Closed
cztomczak opened this issue Apr 29, 2017 · 14 comments
Milestone

Comments

@cztomczak
Copy link
Owner

cztomczak commented Apr 29, 2017

If you get such an error on Windows:

import cefpython3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python3\lib\site-packages\cefpython3\__init__.py", line 59, in <module>
    from . import cefpython_py36 as cefpython
ImportError: DLL load failed: The specified module could not be found.

Then most probably this is caused, because you are missing "msvcp140.dll" dependency (for Python 3 for example). This is a dependency for Python C++ extensions (eg. cefpython_py36.pyd depends on it). For Python 3 to fix this download Visual C++ Redistributable for VS2015 (13 MB) - this is just a VC++ redistributable, not a Visual Studio package. For 32-bit download "vc_redist.x86.exe" file and for 64-bit download "vc_redist.x64.exe" file.

Explanation: msvcp140.dll is the DLL for the C++ runtime library. This dependency is added by Cython when building CEF Python module. It seems that Python 3.6 only ships "vcruntime140.dll" which is the DLL for the C runtime library.

When using pyinstaller/py2exe tools for freezing application into exe then these tools should automatically detect the msvcp140.dll dependency and ship it with your application. So it's not an issue for packaged apps.

This info is also available in the Knowledge Base document.

Possible solutions

  1. Ship the msvcp140.dll file along with CEF and CEF Python binaries
@cztomczak cztomczak changed the title CEF Python running on Python 3.5/3.6 requires msvcp140.dll which apparently isn't shipped by Python Windows: Running on Python 3.5/3.6 requires msvcp140.dll which apparently isn't shipped by Python Apr 29, 2017
@cztomczak cztomczak added the bug label Apr 29, 2017
@cztomczak cztomczak added this to the v58 milestone Apr 29, 2017
@resristow
Copy link

The link to C++ library is broken.
Here's the right one: https://www.microsoft.com/en-us/download/details.aspx?id=52685

@cztomczak
Copy link
Owner Author

@resristow Thanks, updated.

@carlosperate
Copy link

About the pyinstaller bit, there are some issue with some of these windows crt libraries: pyinstaller/pyinstaller#1566
Not sure what the current state is, but I though I should mention it just in case.

@cztomczak cztomczak changed the title Windows: Running on Python 3.5/3.6 requires msvcp140.dll which apparently isn't shipped by Python [Windows] Running on Python 3.5/3.6 requires msvcp140.dll which apparently isn't shipped by Python Aug 23, 2017
@TheInitializer
Copy link

How can I fix this on a system where I might not have admin privileges? Where can I download the standalone DLL?

@cztomczak
Copy link
Owner Author

Fixed in rev 5030b89 and c852685. This fix includes msvcpxx.dll dependencies for all Python versions 2.7 / 3.4 / 3.5 / 3.6 / 3.7 (msvcp90.dll, msvcp100.dll, msvcp140.dll). This fix will make it into v66 release.

The latest Visual C++ redistributable for Python 3.5 / 3.6 / 3.7 is available at this link (14.00.24212):
https://www.microsoft.com/en-us/download/confirmation.aspx?id=53587

Versions of VC++ runtimes shipped with Python versions:

  • 2.7.14 - 9.00.30729.1
  • 3.4.4 - vcruntime not shipped with Python (latest installed on my system is 10.00.40219.325)
  • 3.5.4 - 14.00.24210.0
  • 3.6.6 - 14.00.24210.0
  • 3.7.0 - 14.12.25810.0

The vc++ runtime shipped with Python 3.7.0 is newer than the latest vc++ redistributable package available at Microsoft Downloads, so that's strange. I have 14.00.24212 on my system and Python 3.7.0 works fine with cefpython v66.

@karolyjozsa
Copy link

karolyjozsa commented Feb 23, 2021

Installed cefpython3 v66.1 on Win7 64bit with Python 3.7.2. I have several versions of MS C++ (2013 and 2017, no 2015), the latest is 14.15.26706.0. The msvcp140.dll file exists in C:\Windows\System32. I still hit this issue. I use venv because I am not an admin on my PC, i.e. I cannot install any other MS C++ redistributable, I have to live with what I have. Can you help me?

@cztomczak
Copy link
Owner Author

Does it also occur with v66.0? @karolyjozsa

@karolyjozsa
Copy link

Huh, v66.0 seems to work. Thanks a lot, I will now then install and use this until a fix comes out in 66.2(?).

@cztomczak
Copy link
Owner Author

cztomczak commented Feb 24, 2021

Hmm I don't know what's the issue yet. The difference with 66.1 is that I've used VC++ 14.2 compiler to build. It worked fine for me to build all Python modules with that version of compiler (from Python 3.5 up to Python 3.9) and it ran fine. According to Microsoft the VC++ 14.2 compiler is binary compatible with VC++ 14.0 that cefpython 66.0 was built with.

@karolyjozsa What OS are you testing with? What Python version? Is this an official Python binary downloaded from python.org? What if you copy msvcp140.dll from cef v66.0 to cef v66.1? (Steps: install 66.0, go to Python/lib/site-packages/cefpython3/ and make a copy of msvcp140.dll, then install v66.1 and replace the msvcp140.dll with the one you made a copy earlier).

@cztomczak
Copy link
Owner Author

@karolyjozsa Test also what happens when you delete msvcp140.dll from the cefpython3 directory (with both 66.0 and 66.1).

@karolyjozsa
Copy link

That PC has Win7 64bit, Python 3.7.2 and several versions of MS C++, 10.0.x, 12.0.x, 14.15.26706.0, but no 14.0.x.
Sorry, I cannot play with that PC (like copying v66.0 dll into a v66.1 installation), because it is running a live server app, regularly used by users.
v66.0 installation contains msvcp90, 100,140 dlls.
v66.1 contains 3 files with the same names, but e.g. the 2x msvcp140.dll files are not the same, according to fc (file compare)
Note that I tried v66.1 on a different PC (Win10 64bit, Python 3.7.4 having MS C++ 2015; 14.0.24210.0) and it has no import error.
My wild guess is that not having MS C++ version of 14.0.x (even if having newer like 14.15.x) makes v66.1 not finding the dll.

@cztomczak
Copy link
Owner Author

Would be good to test it on another Win7 machine.

@karolyjozsa
Copy link

We have otherWin7 PCs, but they all have the same company-standard OS image, i.e. same MS C++ versions, so most probably they would result the same.

@karolyjozsa
Copy link

I now created another venv on the same PC. First installed v66.0 explicitly, then pip update to v66.1. The funny thing is that there is no "dll load fail" anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants