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: Windows build cannot detect missing Windows SDK
Type: compile error Stage: resolved
Components: Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: White1, Zack_Barton, jaraco, lukasz.langa, miss-islington, mytechnotalent, pablogsal, steve.dower
Priority: normal Keywords: patch

Created on 2021-02-22 17:25 by mytechnotalent, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 26800 merged steve.dower, 2021-06-19 10:56
PR 26802 merged miss-islington, 2021-06-19 12:45
PR 26803 merged miss-islington, 2021-06-19 12:45
Messages (11)
msg387518 - (view) Author: Kevin Thomas (mytechnotalent) Date: 2021-02-22 17:25
When compiling for Windows it does not properly handle the version string MSB4184

C:\Users\kevin\cpython>PCbuild\build.bat
Using py -3.7 (found 3.7 with py.exe)
Fetching external libraries...
bzip2-1.0.6 already exists, skipping.
sqlite-3.34.0.0 already exists, skipping.
xz-5.2.2 already exists, skipping.
zlib-1.2.11 already exists, skipping.
Fetching external binaries...
libffi already exists, skipping.
openssl-bin-1.1.1i already exists, skipping.
tcltk-8.6.10.0 already exists, skipping.
Finished.
Using "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" (found in the Visual Studio installation)

C:\Users\kevin\cpython>"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" "C:\Users\kevin\cpython\PCbuild\pcbuild.proj" /t:Build /m /nologo /v:m /clp:summary /p:Configuration=Release /p:Platform=x64 /p:IncludeExternals=true /p:IncludeCTypes=true /p:IncludeSSL=true /p:IncludeTkinter=true /p:UseTestMarker= /p:GIT="C:\Program Files\Git\cmd\git.exe"
C:\Users\kevin\cpython\PCbuild\python.props(111,31): error MSB4184: The expression "[System.Version]::Parse('')" cannot
 be evaluated. Version string portion was too short or too long. [C:\Users\kevin\cpython\PCbuild\pythoncore.vcxproj]

Build FAILED.

C:\Users\kevin\cpython\PCbuild\python.props(111,31): error MSB4184: The expression "[System.Version]::Parse('')" cannot
 be evaluated. Version string portion was too short or too long. [C:\Users\kevin\cpython\PCbuild\pythoncore.vcxproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.06
msg387529 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-22 18:49
This should mean that you haven't got the Windows SDK installed, though it might mean that you've got a *newer* WinSDK where they've changed the registration format.

But more likely you deselected it when installing C++ support through Visual Studio. Could you open Visual Studio Installer and ensure that the newest Windows SDK item is selected?

Assuming the spammers go away, we can use this bug to improve the error message. If they persist, we'll lock this and open a new one.
msg387533 - (view) Author: Kevin Thomas (mytechnotalent) Date: 2021-02-22 19:03
Thank you Steve.  I did not have the latest installed which is Win10SDK_10.0.18362, therefore it did trigger that original error in msg387518.

After installing, Win10SDK_10.0.18362, it did in-fact allow a successful compilation.

Updating that error code would be most helpful to Windows developers.  I would have never caught it but I wanted to help test 3.10 so I thought I should try it on the Windows 10 box to make sure the community had all platforms covered.

RESULTS:
Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:01:10.34

C:\Users\kevin\cpython>python.bat
Running Release|x64 interpreter...
Python 3.10.0a5+ (heads/master:91a639a094, Feb 22 2021, 14:01:03) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
msg387561 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-23 11:15
> I did not have the latest installed which is Win10SDK_10.0.18362, therefore it did trigger that original error in msg387518.

Did you have any other version installed? It should include one by 
default, which is why we don't mention it in the quick instructions, but 
I think you can remove it at install time.
msg387563 - (view) Author: Kevin Thomas (mytechnotalent) Date: 2021-02-23 12:05
Hi Steve actually there was none installed which was strange as I had Visual Studio installed but it was not checked by default.  After selecting it and installing it, everything works as expected.  Updating the error message in some way might be helpful.
msg395530 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2021-06-10 12:37
In issue44246, I've encountered this error while attempting to build CPython in a Docker image (built from https://github.com/jaraco/jaraco.windows/blob/d2edad2e2af9d469189d7ac6a14a4ba6f6270348/Dockerfile). Any suggestions on how to install the SDK to a viable version in a headless environment?
msg395666 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-06-11 22:13
Jason - I think your -add and -remove options need work. I'm pretty sure the AzureBuildTools component doesn't bring in the C++ compilers or the WinSDK.

If you configure it manually and interactively, you should be able to export a JSON configuration and then you can use that later to recreate the install elsewhere.
msg396131 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-06-19 12:45
New changeset 80190b3e533097b55077becddc75423318ab2371 by Steve Dower in branch 'main':
bpo-43298: Improved error message when building without the Windows SDK installed (GH-26800)
https://github.com/python/cpython/commit/80190b3e533097b55077becddc75423318ab2371
msg396195 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-06-20 20:12
New changeset 5fbccb763ce540c0d07be86660e0357bffc69d76 by Miss Islington (bot) in branch '3.10':
bpo-43298: Improved error message when building without the Windows SDK installed (GH-26800) (GH-26802)
https://github.com/python/cpython/commit/5fbccb763ce540c0d07be86660e0357bffc69d76
msg397050 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2021-07-06 17:23
I was able to export the configuration using these instructions: https://docs.microsoft.com/en-us/visualstudio/install/import-export-installation-configurations?view=vs-2019

That produced this config:

{
  "version": "1.0",
  "components": [
    "Microsoft.VisualStudio.Component.CoreEditor",
    "Microsoft.VisualStudio.Workload.CoreEditor",
    "Microsoft.VisualStudio.Component.Roslyn.Compiler",
    "Microsoft.Component.MSBuild",
    "Microsoft.VisualStudio.Component.TextTemplating",
    "Microsoft.VisualStudio.Component.VC.CoreIde",
    "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
    "Microsoft.VisualStudio.Component.Windows10SDK.19041",
    "Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
    "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
    "Microsoft.VisualStudio.Workload.NativeDesktop"
  ]
}

Using that, I tried to install those components using vs_buildtools:

# Install Visual Studio
RUN ./vs_buildtools.exe --quiet --wait --norestart --nocache \
 --add Microsoft.VisualStudio.Component.CoreEditor \
 --add Microsoft.VisualStudio.Workload.CoreEditor \
 --add Microsoft.VisualStudio.Component.Roslyn.Compiler \
 --add Microsoft.Component.MSBuild \
 --add Microsoft.VisualStudio.Component.TextTemplating \
 --add Microsoft.VisualStudio.Component.VC.CoreIde \
 --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \
 --add Microsoft.VisualStudio.Component.Windows10SDK.19041 \
 --add Microsoft.VisualStudio.Component.VC.Redist.14.Latest \
 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core \
 --add Microsoft.VisualStudio.Workload.NativeDesktop


In order to avoid noise here, I'm going to continue the investigation in  https://github.com/jaraco/jaraco.windows/issues/21.
msg397324 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-07-12 15:11
New changeset e7009f4f9a6a55036ef628a07bedc8dab1aa851e by Miss Islington (bot) in branch '3.9':
bpo-43298: Improved error message when building without the Windows SDK installed (GH-26800) (#26803)
https://github.com/python/cpython/commit/e7009f4f9a6a55036ef628a07bedc8dab1aa851e
History
Date User Action Args
2022-04-11 14:59:41adminsetgithub: 87464
2021-07-12 15:11:37lukasz.langasetnosy: + lukasz.langa
messages: + msg397324
2021-07-06 17:23:53jaracosetmessages: + msg397050
2021-06-20 20:12:49pablogsalsetnosy: + pablogsal
messages: + msg396195
2021-06-19 12:50:16steve.dowersetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: + Python 3.9, Python 3.11
2021-06-19 12:45:32steve.dowersetmessages: + msg396131
2021-06-19 12:45:30miss-islingtonsetpull_requests: + pull_request25384
2021-06-19 12:45:25miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request25383
2021-06-19 10:56:04steve.dowersetkeywords: + patch
stage: patch review
pull_requests: + pull_request25381
2021-06-11 22:13:01steve.dowersetmessages: + msg395666
2021-06-10 12:37:52jaracosetnosy: + jaraco
messages: + msg395530
2021-02-23 12:05:55mytechnotalentsetmessages: + msg387563
2021-02-23 11:15:45steve.dowersetmessages: + msg387561
2021-02-22 19:06:19eryksunsetmessages: - msg387525
2021-02-22 19:06:16eryksunsetmessages: - msg387522
2021-02-22 19:06:11eryksunsetmessages: - msg387521
2021-02-22 19:03:14mytechnotalentsetmessages: + msg387533
2021-02-22 18:49:02steve.dowersetmessages: + msg387529
title: Windows build issue -> Windows build cannot detect missing Windows SDK
2021-02-22 18:26:03White1setmessages: + msg387525
2021-02-22 18:12:10White1setnosy: + White1
messages: + msg387522
2021-02-22 17:57:26Zack_Bartonsetnosy: + Zack_Barton
messages: + msg387521
2021-02-22 17:27:04vstinnersetnosy: + steve.dower
2021-02-22 17:25:51mytechnotalentcreate