conda-forge / netcdf4-feedstock

A conda-smithy repository for netcdf4.
BSD 3-Clause "New" or "Revised" License
3 stars 25 forks source link

Python 2 build of latest? #102

Closed ChrisBarker-NOAA closed 1 year ago

ChrisBarker-NOAA commented 4 years ago

Could we please enable a Python2 build?

Yes, I know we all should have gone to py3 by now, but I'm sure I'm not alone in having legacy systems that are still on py2.

And it turns out that there have been some changes to Tomcat / TDS that break older versions of the netcdfC lib. So we REALLY need the latest netcdfC lib.

And it looks like the latest py2 build requires netcdf < 4.7:

libnetcdf >=4.6.1,<4.7.0a0

and 4.6.1 is over a year old, so we really need this.

And at least on Windows, the whole stack has to be built with the py2 compatible compiler, so I'm not entirely sure how to get that done.

I think there's a way to ping the bot to build for py2, but I can't find the docs for that right now. But it it's a simple as that, let's do it!

ocefpaf commented 4 years ago

Conda-forge dropped Python 2 support a while back but netcdf4 cannot be built with latest libnetcdf on Windows even if we wanted to. Support for vc9, the compiler compatible with Python 2.7 on Windows, was dropped by upstream back in 2018. See https://github.com/conda-forge/libnetcdf-feedstock/pull/61

If you can get patches to build libnetcdf with vc9 support then you can use https://conda-forge.org/docs/maintainer/infrastructure.html#conda-forge-admin-please-add-python-2-7 to get netcdf4 built for Python 2.7.

PS: heads up, it is probably easier to upgrade your python!

marcelotrevisani commented 4 years ago

Indeed, migrate to Python 3 might be easier than build it with python 2

There are some tools which can help you with the migration to python 3, one which I would like to recommend is pyupgrade

https://github.com/asottile/pyupgrade/

ChrisBarker-NOAA commented 4 years ago

Thanks: I figured there was a reason here. So the key problem is that the netcdf lib doesn't support the ancient Windows compiler. Frankly, I really wish cPython had gone to a more modern compiler for 2.7 a while ago, but they certainly never will now.

And yes, it's time to go to py3 -- which we have done for most of our stuff, and will do for the rest soon. But we have an old web service built on not just py2, but also an old Pythons, and other old libs, so going to py3 is a major task :-(

But for now -- it's not possible to update to newer netcdf lib for Windows, but can we build for OS-X and LInux?

How would I use: conda-forge-admin, please add python 2.7 -- while turning it off for Windows?

ChrisBarker-NOAA commented 4 years ago

@ocefpaf:

Well, getting netcdf to build with VS9 is, indeed too much.

But the latest versions of libnetcdf and netcdf4 seem to work fine wioth py2 on OS-X and I assume Linux, which would be very helpful. It looks to me like the proper selectors are already in place to keep netcdf4 from trying to build py2 on Windows, so can we enable it on the repo for Linux and Mac?

Note, I see in: https://conda-forge.org/docs/maintainer/infrastructure.html#conda-forge-admin-please-add-python-2-7

That:" Note that this command will remove any other Python versions and any win, aarch64 or ppc64le builds. Thus you should merge the PR into a separate branch on your feedstock if you want to keep these other builds." I'm not sure of the status of those here.

And I'm not sure how to do it as a non-maintainer, as it says: "Entering this command in the title of an issue..." Can I really just create an issue and turn this on?

Luthaf commented 4 years ago

Would it be possible to add a Python2 build only on linux64 and osx64, and disable win64+py2? It could still be useful to some people. If you think it is worth it, I can try to send a PR for it.

ocefpaf commented 1 year ago

BTW, it has been a while that netcdf4 is no longer compatible with python 2.7. Unless someone is willing to patch it I believe we can close this issue.

ChrisBarker-NOAA commented 1 year ago

Yes, Py2 is finally truly legacy -- closing.