Pybind11: Build fails with Visual Studio 15 2017 Win64

Created on 22 Jan 2020  路  7Comments  路  Source: pybind/pybind11

Issue description

Build fails with Visual Studio 15 2017 Win64

Setup

  • Windows 10 64 bits
  • Python 3.7.6 64 bits
  • Visual Studio Build Tools 2017

Expected behavior

Test cases build successfully

Actual result

Build FAILED.

"C:\Users\Ismael_Venegas\Projects\pybind11\build\tests\check.vcxproj" (default targe
t) (1) ->
"C:\Users\Ismael_Venegas\Projects\pybind11\build\tests\test_cmake_build\test_cmake_b
uild.vcxproj" (default target) (7) ->
"C:\Users\Ismael_Venegas\Projects\pybind11\build\tests\test_cmake_build\test_install
ed_embed.vcxproj" (default target) (8) ->
(CustomBuild target) ->
  C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTa
rgets\Microsoft.CppCommon.targets(209,5): error MSB6006: "cmd.exe" exited with code
1. [C:\Users\Ismael_Venegas\Projects\pybind11\build\tests\test_cmake_build\test_inst
alled_embed.vcxproj]


"C:\Users\Ismael_Venegas\Projects\pybind11\build\tests\check.vcxproj" (default targe
t) (1) ->
"C:\Users\Ismael_Venegas\Projects\pybind11\build\tests\test_cmake_build\test_cmake_b
uild.vcxproj" (default target) (7) ->
"C:\Users\Ismael_Venegas\Projects\pybind11\build\tests\test_cmake_build\test_subdire
ctory_embed.vcxproj" (default target) (12) ->
  C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTa
rgets\Microsoft.CppCommon.targets(209,5): error MSB6006: "cmd.exe" exited with code
1. [C:\Users\Ismael_Venegas\Projects\pybind11\build\tests\test_cmake_build\test_subd
irectory_embed.vcxproj]

    0 Warning(s)
    2 Error(s)

Reproducible example code

git clone https://github.com/pybind/pybind11
cd pybind11
mkdir build
cd build
cmake -A x64 ..  # or: cmake .. -G "Visual Studio 15 2017 Win64"
cmake --build . --config Release --target check

Related StackOverflow question:

Most helpful comment

@YannickJadoul thank you very much for your support, I needed to add %PYTHONHOME%\Lib to my path, this solved my issue.

All 7 comments

I get the same errors when I build it from the Command Prompt.

OS: Windows 10.0.17134
Windows SDK: 10.0.18362.0
Compiler: Visual Studio 2019 Community edition
Build Engine: 16.4.0+e901037fe
CMake: 3.16.3
Python: 3.7.6

@SalchiPapa Do you have more output from the build? This doesn't show the 2 errors that are mentioned.

This is the installed_embed.log:

Here I see this error:

CUSTOMBUILD : Fatal Python error : initfsencoding: unable to load the file system codec [C:\Users\Ismael_Venegas\Projects\pybind11\build\tests\test_cmake_build\installed_embed\check.vcxproj]

  ModuleNotFoundError: No module named 'encodings'

@SalchiPapa So that seems to e the actual error, indeed? That's the only clear error I see in those two logs, the "No module named 'encodings'"?

Have you looked up the error and checked e.g. https://stackoverflow.com/a/49977872 or https://stackoverflow.com/a/51911598? It feels like this is not really related to pybind11, given the error message?

@YannickJadoul thank you very much for your support, I needed to add %PYTHONHOME%\Lib to my path, this solved my issue.

Was this page helpful?
0 / 5 - 0 ratings