Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build Python C extensions on windows-2022 #5141

Closed
1 of 7 tasks
lpsinger opened this issue Feb 25, 2022 · 10 comments
Closed
1 of 7 tasks

Cannot build Python C extensions on windows-2022 #5141

lpsinger opened this issue Feb 25, 2022 · 10 comments
Assignees
Labels
bug report investigate Collect additional information, like space on disk, other tool incompatibilities etc. OS: Windows

Comments

@lpsinger
Copy link

Description

When we try to build Python C extensions on windows-2022, the build fails see GitHub Actions log with the following error message:

error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
221

This worked on windows-2019. We noticed it because windows-latest just bumped to windows-2022.

Virtual environments affected

  • Ubuntu 18.04
  • Ubuntu 20.04
  • macOS 10.15
  • macOS 11
  • Windows Server 2016
  • Windows Server 2019
  • Windows Server 2022

Image version and build link

20220220.1

Is it regression?

No response

Expected behavior

The Python C extension should be built without errors.

Actual behavior

The build fails with the error message noted above.

Repro steps

Build any Python C extension. See https://github.com/astropy/pytest-doctestplus/blob/main/.github/workflows/python-tests.yml

lpsinger added a commit to lpsinger/pytest-doctestplus that referenced this issue Feb 25, 2022
The windows-latest GitHub Actions virtual environment just switched
from windows-2019 to windows-2022. The windows-2022 virtual
environment cannot build Python C extensions (see
actions/runner-images#5141). As a temporary workaround,
switch to using windows-2019.

Fixes scientific-python#177.
abravalheri added a commit to abravalheri/setuptools that referenced this issue Feb 25, 2022
Temporarily use windows-2022, since Microsoft Visual C++ is not
available on the Windows environment: actions/runner-images#5141.
@isuruf
Copy link

isuruf commented Feb 26, 2022

Looks like tox is not passing through PROGRAMFILES(x86) and PROGRAMDATA env variables (nor PROGRAMFILES env variable) and because of that distutils falls back to a vs2015 style registry key lookup and this registry key is not set in windows-2022 image.

@mikhailkoliada mikhailkoliada added investigate Collect additional information, like space on disk, other tool incompatibilities etc. OS: Windows and removed needs triage labels Feb 28, 2022
@mikhailkoliada
Copy link
Contributor

@lpsinger thanks, we will take a look!

@nikolai-frolov
Copy link
Contributor

@lpsinger could you please share the simple project/yml which allows to reproduce the issue in case it's still actual?

@nikolai-frolov
Copy link
Contributor

@lpsinger this yml doesn't work for me without additional steps: https://github.com/nikolai-frolov/image-testing/actions/runs/1910180528. Please provide a simple example.

@lpsinger
Copy link
Author

lpsinger commented Mar 1, 2022

See https://github.com/lpsinger/github-actions-windows-2022-python-c-extension. This is as simple as I can make it.

@mayeut
Copy link

mayeut commented Apr 2, 2022

Given the number of issues linked, not sure if "It is a tox issue" applies in all cases but at least, for the minimal reproducer shared by @lpsinger, it is tox-dev/tox#2382.
Installing tox from main solves the issue: https://github.com/mayeut/github-actions-windows-2022-python-c-extension/runs/5799864485?check_suite_focus=true

@pllim
Copy link

pllim commented Apr 4, 2022

Speaking for astropy/pytest-doctestplus (source of the original post), it is undesirable for us to be using dev tox but we'll be happy to try this tox fix out once it is released. Thanks!

@dsame
Copy link
Contributor

dsame commented Apr 11, 2022

Hello @lpsinger,

Can you please try to re-run you build with windows-latests without other changes?

I forked and reverted your repo to the failed commit scientific-python/pytest-doctestplus@feea983

and the build passed https://github.com/akv-platform/pytest-doctestplus/actions/runs/2149804973
also i run the build the repo head and it passed as well https://github.com/akv-platform/pytest-doctestplus/runs/5975846421?check_suite_focus=true

JFI: i suspected there's some issue with the tox could not find build tools due to something related to this setting https://docs.python.org/3/distutils/apiref.html#module-distutils.msvccompiler but i am not able to investigate the problem because it is not reproduced.

@lpsinger
Copy link
Author

Working again now. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report investigate Collect additional information, like space on disk, other tool incompatibilities etc. OS: Windows
Projects
None yet
Development

No branches or pull requests

7 participants