Skip to content

[BUG] -requiresAny is not recognized by Visual Studio 2017 < v15.6 #3946

@AndrewTsao

Description

@AndrewTsao

setuptools version

setuptools==67.8.0

Python version

Python 3.09, 3.10, 3.11

OS

Windows Server 2012r2

Additional environment information

No response

Description

Hi,

I encountered an error when using setup.py to compile a module related to pybind11. The error message was pybind11\detail/common.h(86): fatal error C1189: #error: pybind11 2.10+ requires MSVC 2017 or newer. But I actually had VS2017 installed. Later, I found that the _msvccompiler.py module in setuptools seemed to be highly optimized, causing the _get_vc_env function to always return the environment variables of MSVC14. And I tried to add some print statements in that function, but nothing was printed, proving that the function was never called. Finally, I renamed _get_vc_env to _get_vc_env1, and setup.py worked fine.

I tried to print the name of the _get_env_vc function, and the actual output was “<function msvc14_get_vc_env at 0xxxxxxxx>.”, which looked like a function that was optimized for a specific compiler.

Expected behavior

setuptools can dected vs2017 environment.

How to Reproduce

  1. Call a python setup.py to compile c++ extension.

Output

\.py3.11\lib\site-packages\pybind11\include\pybind11\detail/common.h(86): fatal error C1189: #error:  pybind11 2.10+ requires MSVC 2017 or newer

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageIssues that need to be evaluated for severity and status.bug

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions