CMake Build Error: Missing "Python.h"

Since recently my builds on VS2019 fails with the following log(I wish I could attach .log files here):

Checking Build System
CMake is re-running because C:/Users/user/Documents/build_windows_x64_vc16_Release/CMakeFiles/generate.stamp is out-of-date.
the file ‘C:/Users/user/Documents/blender/CMakeLists.txt’
is newer than ‘C:/Users/user/Documents/build_windows_x64_vc16_Release/CMakeFiles/generate.stamp.depend’
result=’-1’
– 64 bit compiler detected.
– Visual Studio 2019 detected.
CMake Error at CMakeLists.txt:1582 (message):
Missing:
“C:/Users/user/Documents/blender/…/lib/win64_vc14/python/37/include/Python.h”,

Set the cache entry 'PYTHON_INCLUDE_DIR' to point to a valid python include
path.  Containing Python.h for python version "3.7"

– Configuring incomplete, errors occurred!
See also “C:/Users/user/Documents/build_windows_x64_vc16_Release/CMakeFiles/CMakeOutput.log”.
CMake Configure step failed. Build files cannot be regenerated correctly. Attempting to stop IDE build.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(220,5): error MSB6006: “cmd.exe” exited with code -1073741819. [C:\Users\user\Documents\build_windows_x64_vc16_Release\ZERO_CHECK.vcxproj]

Build FAILED.

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(220,5): error MSB6006: “cmd.exe” exited with code -1073741819. [C:\Users\user\Documents\build_windows_x64_vc16_Release\ZERO_CHECK.vcxproj]
0 Warning(s)
1 Error(s)

Time Elapsed 00:00:03.36

The mentioned missing file is actually located at:
C:\Users\user\Documents\blender\lib\win64_vc14\python\37\include\Python.h

I have updated my svn libs.

The Python libraries were updated recently, maybe you need to update the win64_vc14 directory.

I did this, but it didn’t solve the problem:
svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/win64_vc14 lib/win64_vc14

1 Like

It’s not necessary to checkout the libraries again if you already have them. Normally running make update in the main Blender source directory should update everything including these libraries.

For just the libraries you run svn update in the lib/win64_vc14 folder.

It may also help do a clean building, completely removing the build_windows_x64_vc16_Release folder and building again.

1 Like

i had to do svn cleanup and svn up to get it working.