Skip to content

Conversation

henryiii
Copy link
Contributor

@henryiii henryiii commented Apr 22, 2021

Hoping to fix the issues seen in current CI runs. At the very least, we will follow the style guide linked below.

Following https://docs.chocolatey.org/en-us/choco/commands/#scripting-integration-best-practices-style-guide

  • Avoid -f in scripts
  • Always use -y in scripts
  • Use upgrade instead of install in scripts
  • Use --limit-output for more parsable output (should turn off progress bar as well, hopefully)

The issue with vcpython27 might be temporary, caused by the -f, or possibly permanent since it has been untouched since 2016.

@henryiii
Copy link
Contributor Author

henryiii commented Apr 22, 2021

Looks to me that Microsoft has finally killed of VS for Python 2.7?

https://www.microsoft.com/en-us/download/details.aspx?id=44266 redirects to https://www.microsoft.com/en-us/download/404Error.aspx

@joerick
Copy link
Contributor

joerick commented Apr 23, 2021

Wow, yeah you might be right! But it's very abrupt... also the package is still in the chocolately
directory which is confusing: https://community.chocolatey.org/packages/vcpython27 . It might be a mistake / temporary issue.

By the way @henryiii, how was your style normalisation work coming along? This might be a nice time to merge the drop 2.7 branch #596 ! :)

@henryiii
Copy link
Contributor Author

Let's give it a little time; not sure who to contact about it but it would be nice to get confirmation if this was intentional. The chocolaty package is not "official", so it isn't likely to be removed in sync with the old download. I can't find any statement saying they planned to drop the download, but the download is still missing.

If we do have to drop this old workaround, we need to drop it on the v1 branch anyway so that our CI isn't dead for supporting the LTS version. My secret target date for 596 is when 3.5 gets dropped from manylinux (May 1) so we can remove both at the same time. Sadly, manylinux1 will keep supporting both, so v1 can stay as is.

First batch (style in bin) is either done or almost done, then I'll do cibuildwheel. Assume we really don't care that much about test/unit_test style and are fine to accept whatever gets produced there.

@henryiii
Copy link
Contributor Author

henryiii commented Apr 23, 2021

I've contacted Microsoft support, and:

I'm very sorry Henry, but the Visual Studio for Python 2.7 is not available for download since it is currently not supported anymore.

It also says on the VS page:

Visual Studio 2008 reached end of support on April 10, 2018. To aid the discovery of the latest downloads, the links are retained currently, but may be removed in the future.

So maybe someone will put pressure on them to restore it and it might show up again (I'm not going to do that!), but currently the plan is that it's gone and will stay that way.

@joerick
Copy link
Contributor

joerick commented Apr 23, 2021

No idea what happened with the Azure run, it said 'Cancelled'. I've restarted it...

@henryiii
Copy link
Contributor Author

Passing. I think this should be rebased and merged, just in case this is restored or fixed and someone wants to revert just the second commit some day.

Copy link
Contributor

@joerick joerick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. Let's do it. So we're saying here that you need https://github.com/ilammy/msvc-dev-cmd to build 2.7 on Windows?

@henryiii
Copy link
Contributor Author

henryiii commented Apr 25, 2021

You need to "override" the default compiler in order to build for 2.7 on Windows. If you override with the original 2.7 2008 compiler, you can still build 2008 extensions (of course, you need to find a copy somewhere). If you choose a newer one, you have to be a little careful in how you use Python (tools like pybind11 are), and you have to have the 2015 redistributable. Since the 2008 compiler is really, really old, I think pretty much the norm on Windows is to override and use the 2015 compiler, or just to not support 2.7 on Windows at all.

Override == setting DISTUTILS_USE_SDK and MSSdk.

@henryiii henryiii merged commit 22d473a into pypa:master Apr 25, 2021
@joerick
Copy link
Contributor

joerick commented Apr 25, 2021

Gotcha. Just figuring out how we might document this. I'm thinking an FAQ entry like this. Any thoughts?


Windows and Python 2.7

Building 2.7 extensions on Windows is difficult, because the VS2008 compiler that was used for the original Python compilation is difficult to find these days. Most people choose to not build Windows 2.7 wheels, or to override the compiler to something more modern.

To override, you need to have a modern compiler toolchain activated, and set DISTUTILS_USE_SDK=1 and MSSdk=1. For example, on Github Actions, you would add these steps:

    - name: Prepare compiler environment for Windows
      if: runner.os == 'Windows'
      uses: ilammy/msvc-dev-cmd@v1
      with:
        arch: x64

    - name: Set Windows environment variables
      if: runner.os == 'Windows'
      shell: bash
      run: |
        echo "DISTUTILS_USE_SDK=1" >> $GITHUB_ENV
        echo "MSSdk=1" >> $GITHUB_ENV

Note that changing to a more modern compiler will mean your wheel picks up a runtime dependency to a different Visual C++ Redistributable.

@henryiii henryiii deleted the ci/choco branch April 25, 2021 14:14
@henryiii
Copy link
Contributor Author

Building 2.7 extensions on Windows is difficult, because the VS 2008 compiler that was used for the original Python compilation was discontinued in 2018, and has since been removed from Microsoft's downloads. Most people choose to not build Windows 2.7 wheels, or to override the compiler to something more modern.

...

cibuildwheel will not try to build 2.7 on Windows unless it detects that the above two variables are set. Note that changing to a more modern compiler will mean your wheel picks up a runtime dependency to a different Visual C++ Redistributable. You also need to be a bit careful in designing your extension; some major binding tools like pybind11 do this for you.

@joerick
Copy link
Contributor

joerick commented Apr 27, 2021

Thanks @henryiii , I'm adding this to #650 now.

You also need to be a bit careful in designing your extension

Any hints on this? Or maybe a link? I'm wondering what a reader would do with this tantalising quantum of wisdom ;)

@henryiii
Copy link
Contributor Author

@joerick
Copy link
Contributor

joerick commented Apr 27, 2021

🙌 perfect

@YannickJadoul
Copy link
Member

https://pybind11.readthedocs.io/en/stable/faq.html#working-with-ancient-visual-studio-2008-builds-on-windows

Didn't we already have a link to that, somewhere? Probably in the "Python 2.7 on Windows" section.

@joerick
Copy link
Contributor

joerick commented Apr 30, 2021

You are right - https://cibuildwheel.readthedocs.io/en/stable/cpp_standards/#windows-and-python-27

The section in cpp-standards goes into a bit more depth, I'll link there from the FAQ.

@YannickJadoul
Copy link
Member

The section in cpp-standards goes into a bit more depth, I'll link there from the FAQ.

Can't have too many links from different places for this, indeed. Apparently it's hidden enough for the maintainers themselves to miss it ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants