This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: 2.7.11 Windows Installer issues on Win2008R2
Type: crash Stage: resolved
Components: Installation, Windows Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: steve.dower Nosy List: David Rader, benjamin.peterson, eryksun, loewis, paul.moore, python-dev, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2016-01-16 14:12 by David Rader, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (5)
msg258387 - (view) Author: David Rader (David Rader) Date: 2016-01-16 14:12
Problem 1:
The .manifest information for the VC runtime dll's has been changed in the recent versions of the 2.7.x 64-bit installers for Windows. Python fails to run on a clean Win2008R2 install after running the Python installer to install "Just for me". The installation succeeds if "Install for all users" is selected.

After install completes, trying to run python results in:
The application has failed to start because it's side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.

The event viewer log shows:
Activation context generation failed for "C:\Python27\python.exe".Error in manifest or policy file "C:\Python27\Microsoft.VC90.CRT.MANIFEST" on line 4. Component identity found in manifest does not match the identity of the component requested. Reference is Microsoft.VC90.CRT,processorArchitecture="amd64",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8". Definition is Microsoft.VC90.CRT,processorArchitecture="amd64",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.30729.1". Please use sxstrace.exe for detailed diagnosis.

This means that that VC2008 SP1 dll and manifest are included in the installer, but the Python.exe is compiled against VC2008 (_not_ SP1).
Replacing the installed manifest and VC90 with one pulled from an older distribution with the correct 9.0.21022.8 version enables python to run.

Problem 2:
The compiled DLLs in the DLLs folder incorrectly have the VC manifest included in them as well. This breaks the side-by-side look up, since the VC90 dll is not in the DLLs folder. So if you try to import socket, you get an error message like:
Traceback (most recent call last):
  File "hub\scripts\pgc.py", line 9, in <module>
    import socket
  File "C:\Python27\lib\socket.py", line 47, in <module>
    import _socket
ImportError: DLL load failed: The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.

Previous versions of Python for windows have had this problem but it was corrected. It looks like it has crept back in.
msg258388 - (view) Author: David Rader (David Rader) Date: 2016-01-16 14:45
FYI - as a work around problem 1, after the install I replaced the .manifest file and the VCRT.dll with the older non-SP1 versions and python ran.

Then, to work around problem 2, I used resource hacker to manually delete the manifest from each file in the DLLs directory. these modified versions (without the embedded manifest for VC RT) now work successfully in the side-by-side execution on Win2008R2.
msg258389 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2016-01-16 15:04
I'm a little surprised this is the first we've heard of this issue, but the analysis seems sound.

It's probably a misconfiguration on my build machine, or possibly something to do with the project file backport. I'll look into it.
msg258395 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2016-01-16 16:20
Steve, is this something that can only be reproduced on Windows 7/2008 for some reason? My "just for me" installation on Windows 10 seems to work fine. I installed from "python-2.7.11.amd64.msi" with the MD5 sum 25acca42662d4b02682eee0df3f3446d, which matches the MD5 sum posted on python.org. 

The resource #1 manifest embedded in python.exe uses the following assembly:

    <assemblyIdentity type="win32" 
                      name="Microsoft.VC90.CRT" 
                      version="9.0.21022.8" 
                      processorArchitecture="amd64" 
                      publicKeyToken="1fc8b3b9a1e18e3b">
    </assemblyIdentity>

The resource #2 manifest embedded in python27.dll uses the same assembly. 

However, I can confirm the second problem. The extension modules in DLLs incorrectly have a resource #2 manifest. They should be relying on the activation context from the #2 manifest in python27.dll.
msg275365 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-09-09 18:06
New changeset 313ae9926889 by Steve Dower in branch '2.7':
Issue #26132: Only adds manifest to executables and main DLL.
https://hg.python.org/cpython/rev/313ae9926889
History
Date User Action Args
2022-04-11 14:58:26adminsetgithub: 70320
2016-09-09 18:08:18steve.dowersetstatus: open -> closed
resolution: fixed
stage: resolved
2016-09-09 18:06:52python-devsetnosy: + python-dev
messages: + msg275365
2016-01-16 16:20:10eryksunsetnosy: + eryksun
messages: + msg258395
2016-01-16 15:04:48steve.dowersetassignee: steve.dower
messages: + msg258389
2016-01-16 14:45:43David Radersetmessages: + msg258388
2016-01-16 14:19:15SilentGhostsetnosy: + paul.moore, tim.golden, zach.ware, steve.dower
components: + Windows
2016-01-16 14:12:41David Radercreate