Skip to content

Deprecate Python 2 installations#28003

Merged
adamjstewart merged 5 commits intospack:developfrom
adamjstewart:packages/python2
Jan 10, 2022
Merged

Deprecate Python 2 installations#28003
adamjstewart merged 5 commits intospack:developfrom
adamjstewart:packages/python2

Conversation

@adamjstewart
Copy link
Copy Markdown
Member

@adamjstewart adamjstewart commented Dec 14, 2021

NOTE: To clarify, this PR does not affect which versions of Python can be used to run Spack. Spack will continue to support Python 2.7 and 3.5-3.6 for the foreseeable future. This PR only affects which versions of Python Spack can install.

Contents

This PR deprecates versions of Python that have reached end-of-life. It also deprecates versions of other packages that require deprecated versions of Python. This is in the hopes that maintainers of those packages get pinged on this PR and offer feedback. This PR does not deprecate versions of packages that optionally require deprecated versions of Python (if I could deprecate a specific version/variant combo I would). This PR also does not deprecate versions of packages that rely on deprecated versions of package. I'm hoping that maintainers of those packages will notice this once it is merged. Once these versions are deprecated and a 0.18.0 release comes out, these versions/packages can be removed.

Rationale

Python 2 has been unsupported for almost 2 years, and many of the Spack packages that rely on Python 2 either don't concretize, can't be downloaded, or haven't had a new release in over 10 years. When working on large PRs like #27798, it becomes exceedingly difficult to maintain support for Python 2 and test it properly. If any of these packages/versions are present in a DAG/environment, Spack will install an unsupported version of Python without warning. I don't believe this is safe behavior, and we should work towards deprecating/removing unsupported Python versions.

Discussion

For anyone who has stumbled upon this PR or was automatically pinged, I would welcome feedback on this PR. This PR is not a hard requirement but a request. For anyone who absolutely needs Python 2 or 3.5-3.6 support, I'm willing to keep it, but I would ask that you add yourself as a maintainer for the Python package so that you can help review PRs like #27798. Also, for any of the packages where all versions have been deprecated, if you are aware of a newer release that adds Python 3 support, let me know and I can add it to the package. Otherwise, packages that only support Python 2 will be removed after the next release.

Closes #28022

@adamjstewart
Copy link
Copy Markdown
Member Author

@spackbot maintainers

Copy link
Copy Markdown
Contributor

@trws trws left a comment

Choose a reason for hiding this comment

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

This looks good to me. It's unfortunate that we'll keep supporting 2.7, but that's reality for the moment I suppose. The actual change makes me think having a way to make a deprecation viral might be valuable though, all of the changes outside of python itself are really just side-effects right?

@rblake-llnl
Copy link
Copy Markdown
Contributor

Does this mean python2 won't install no-matter-what, or that we'll have to pass extra flags to support an installation?

I have a legacy application I help that refuses to move off of python2 due to various reasons. I've been building that application with spack as it has over 100 dependencies, but it would be a shame if I had to migrate away from spack.

@adamjstewart
Copy link
Copy Markdown
Member Author

@trws Correct, all changes to packages other than Python are simply a result of the changes to Python. These changes do propagate to other packages in the sense that if you try to install one of these packages that requires Python 2, Spack will prompt you with a warning that the version is deprecated and ask for confirmation before installing.

@rblake-llnl Once this PR is merged, you'll still be able to build with Python, but you'll either need to manually type "Y" to confirm that you want to install with a deprecated version or pass the --yes-to-all flag. After the 0.18.0 release, if we remove those versions of Python 2, Spack will complain that it doesn't know of any Python 2 versions. You should still be able to enter Python 2 as an external package and Spack will build with it, but that assumes that the other packages remain in Spack. I would be fine with un-deprecating any other packages you need if I'm allowed to deprecate and remove Python 2.

@adamjstewart
Copy link
Copy Markdown
Member Author

@spackbot run pipeline

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Dec 15, 2021

I've started that pipeline for you!

@spackbot
Copy link
Copy Markdown

I've started that pipeline for you!

jedbrown
jedbrown previously approved these changes Dec 15, 2021
@HadrienG2
Copy link
Copy Markdown
Contributor

I'm 100% fine with this for affected packages that I contributed to.

@boegel
Copy link
Copy Markdown
Contributor

boegel commented Dec 15, 2021

No objections from my side on deprecating 3.x versions of easybuild, but the packages it requires should be deprecated too in the same way (py-easybuild-framework, py-easybuild-easyblocks, py-easybuild-easyconfigs)?

vvolkl
vvolkl previously approved these changes Dec 15, 2021
@adamjstewart adamjstewart dismissed stale reviews from vvolkl and jedbrown via 12f7118 December 15, 2021 18:03
@Sinan81
Copy link
Copy Markdown
Contributor

Sinan81 commented Dec 16, 2021

🤔

@adamjstewart
Copy link
Copy Markdown
Member Author

As of today, Python 3.6 is also deprecated. I went through all packages again and deprecated a few more. Maintainers on these new packages who may want to see this PR: @RemiLacroix-IDRIS @ax3l @skosukhin

@Sinan81
Copy link
Copy Markdown
Contributor

Sinan81 commented Dec 24, 2021

I'm fine with removing python 2 support. If necessary, I am happy to use latest Spack releases with python 2 support.

@RemiLacroix-IDRIS
Copy link
Copy Markdown
Contributor

@adamjstewart: So deprecated means that Spack won't let you install those versions at all or will it be possible to force the install?

Regarding the VAPOR package that got me notified, I'm a bit annoyed as it is still being used on our cluster even though it currently requires Python 3.6. VAPOR is still maintained so hopefully they will release new versions that support newer Python versions eventually...

@adamjstewart
Copy link
Copy Markdown
Member Author

So deprecated means that Spack won't let you install those versions at all or will it be possible to force the install?

See the docs for details. Once a version is marked as deprecated, fetching the package will cause Spack to prompt the user to warn them that this version is deprecated and ask them if they're sure they want to install it. This prompt can be avoided by using spack install --deprecated if you want to automate this. Once the 0.18 release comes out, we'll then completely remove these versions from Spack. Deprecation is just a first step before removal.

Regarding the VAPOR package that got me notified, I'm a bit annoyed as it is still being used on our cluster even though it currently requires Python 3.6. VAPOR is still maintained so hopefully they will release new versions that support newer Python versions eventually...

Actually, according to NCAR/VAPOR#1822, it seems like they might already support Python 3. Can you investigate this?

@RemiLacroix-IDRIS
Copy link
Copy Markdown
Contributor

Actually, according to NCAR/VAPOR#1822, it seems like they might already support Python 3. Can you investigate this?

They do support Python 3.6 but last time I checked VAPOR failed to compile with Python 3.7+. I will try again.

But anyway there is still a bit of time before VAPOR gets actually removed from Spack.

@tgamblin
Copy link
Copy Markdown
Member

Is this going to affect bootstrapping from source on distros (like RHEL8) where the system python is 3.6? Not sure why that CI test was skipped here.

@adamjstewart
Copy link
Copy Markdown
Member Author

@alalazo would know better than me, but I'm guessing that it won't be an issue. Users should still be able to use externally installed Python 3.6 (or even Python 2) and build packages with it, although we may remove Python 2-only dependencies from packages someday (especially backports that are deprecated here).

@alalazo
Copy link
Copy Markdown
Member

alalazo commented Jan 3, 2022

@tgamblin The rhel8 test is generally skipped in PRs that modify only package recipes. The rationale is that changing a recipe shouldn't affect which Python interpreter can be used to run Spack.

@adamjstewart
Copy link
Copy Markdown
Member Author

If it makes things easier to review/merge I can remove all changes to packages other than Python. Just wanted people to get an idea of which packages would be affected by this deprecation and get a list of people to ping for review.

Copy link
Copy Markdown
Contributor

@cosmicexplorer cosmicexplorer left a comment

Choose a reason for hiding this comment

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

This seems like a really good change!

Copy link
Copy Markdown
Contributor

@sethrj sethrj left a comment

Choose a reason for hiding this comment

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

Looks good! Let the deprecations continue!

@adamjstewart adamjstewart merged commit 7b76e39 into spack:develop Jan 10, 2022
@adamjstewart adamjstewart deleted the packages/python2 branch January 10, 2022 21:45
@varioustoxins
Copy link
Copy Markdown

varioustoxins commented Jan 11, 2022

Sorry I am not a big noise here but this is quite a bad problem in my eyes. Python2 may be dead in some areas but unfortunately it is still very much in use in some areas. Just as much software depended on fortran 77 for many years there is plenty of software that hasn't been updated and won't be for some considerable time (mostly because there isn't money, this doesn't mean the software isn't useful. Grants aren't always easy to get especially if you just want to update to a new version of python that isn't sexy as far as funders are concerned...).

Also we have a duty as a scientific community to be able to reproduce our results. In the UK the timescales for this are at least 10 years (this is how long scientific projects are required to maintain their data and still be able to analyse it to prove reproducibility and accuracy).

Now I could understand saying that all versions except 2.7.18 are deprecated as almost all 2.x software will run on 2.7.18 and this reduces the testing space by a large area.

As a positive example ARIA a program used to calculate many NMR Structures in the PDB is still a 2.7 code base... Xplor also very much used in the NMR structural community has only just gone python3. I am a CoI on the ccpn project (though I speak in a personal position here) https://ccpn.ac.uk they have a new python3 software but still have python2 legacy software.

Also if spack were a fully mature piece of software this would be ok, but I am just having to move from 0.16 to 0.17 to get around bugs in new packages I am writing. what happens when the fix is in 0.19, I presume I just give up.

I hope I am not sounding disruptive just worried, I have spent a lot of time investing in learning how to use spack because of its flexibility and because it didn't kill my installs like home-brew by removing version will nilly. I can still compile programs with really ancient versions of gcc with spack if need be why should I not be able to work with old version of python?

@adamjstewart
Copy link
Copy Markdown
Member Author

adamjstewart commented Jan 11, 2022

For anyone who absolutely needs Python 2 or 3.5-3.6 support, I'm willing to keep it, but I would ask that you add yourself as a maintainer for the Python package so that you can help review PRs like #27798.

Offer still stands 😃

From my perspective, I understand your concerns, and if this was as simple as keeping the version('2.7.18', ...) line in the package, I would agree. However, a very large portion of our build recipe for Python simply deals with differences between different versions of Python. With PRs like #27798 and #28346, the changes in these PRs could easily break Python 2 installations. As a volunteer myself, I don't have the bandwidth to test EOL versions of Python. In #27798, we port our build system to use pip to support newer packages that don't come with a setup.py file. But pip is an entire package manager, and is really overkill for this. In the future, I would like to switch to using build and installer. However, the develop branch of installer requires Python 3.7+.

I think the biggest problem with Python is that much like Spack is still a work in progress, so is Python's build system. The "best practice" instructions for writing and building Python packages have changed so much in the last 2 years that it's been hard for me to keep up with. If we want to keep up with these changes, it will become increasingly difficult if we also need to support EOL versions of Python.

Spack is one of the only package managers in existence that I know of that lets you install something that isn't the latest version of a package. Homebrew and others may have separate packages for major version changes (python2 and python3) but none of them let you pick which version of Python 2 or 3 you get. Spack is trying to solve a much more difficult problem (how do we install every version of a package). Without deprecating old EOL software, this problem becomes intractable.

pbrady pushed a commit to pbrady/spack that referenced this pull request Jan 12, 2022
* Deprecate Python 2 installations

* Deprecate py-python-meep

* Deprecate older easybuild backend libs

* Deprecate Python 3.6

* Deprecate miniconda2
@CAM-Gerlach
Copy link
Copy Markdown

Spack is one of the only package managers in existence that I know of that lets you install something that isn't the latest version of a package. Homebrew and others may have separate packages for major version changes (python2 and python3) but none of them let you pick which version of Python 2 or 3 you get. Spack is trying to solve a much more difficult problem (how do we install every version of a package). Without deprecating old EOL software, this problem becomes intractable.

Just to note, conda, pip and most other Python and language packaging tools (including Homebrew and similar) allow installing any released version of a package just fine, and it is in fact a design requirement of PyPI, Conda-Forge, etc. that once a version is released, it must always remain available barring exceptional circumstances (illegal, malware, etc). In fact, doing so is important for reproducibility, to get the same runtime environment as the code ran in originally, particularly for applications (and by extension, data analysis scripts). AFAIK, its only OS (Linux distro, etc) package managers that tend not to allow this. Of course, this may not be a goal of Spack, which is perfectly fine (and I can very much sympathize with the maintenance burden of still supporting an obsolete Python version, having dropped it in all our packages long ago); just wanted to make sure this was clear.

If there's still a substantial number of users trapped on Python 2 due to the unfortunate reality of grant funding priorities, you could consider making 0.17 a LTS branch maintained by a separate team that accepts bug and security fixes on a best-effort basis. That's more or less what distros like Debian do.

@adamjstewart
Copy link
Copy Markdown
Member Author

For anyone following this discussion, we decided to revert this PR. Thanks to @scheibelp and @varioustoxins for volunteering to help maintain Python 2 support in Spack! I definitely still encourage users to request that packages that still require Python 2 be ported to Python 3, but many packages are no longer maintained yet are still needed for reproducing experiments. If anyone has time to volunteer, tools like 2to3 make it relatively easy to port software libraries from Python 2 to 3.

adamjstewart added a commit that referenced this pull request Jan 20, 2022
EthanS94 pushed a commit to EthanS94/spack that referenced this pull request Feb 17, 2022
* Deprecate Python 2 installations

* Deprecate py-python-meep

* Deprecate older easybuild backend libs

* Deprecate Python 3.6

* Deprecate miniconda2
@adamjstewart adamjstewart mentioned this pull request Mar 23, 2022
4 tasks
tgamblin pushed a commit that referenced this pull request Sep 19, 2022
This PR deprecates using Spack to install [EOL Python versions](https://endoflife.date/python), including Python 2.7, 3.1–3.6. It also deprecates running Spack with Python 2.7. Going forward, we expect Spack to have the following Python support timeline.

### Running Spack

* Spack 0.18 (spring 2022): Python 2.7, 3.5–3.10
* Spack 0.19 (fall 2022): Python 2.7 (deprecated), 3.6–3.11
* Spack 0.20 (spring 2023): Python 3.6–3.11

### Building with Spack

* Spack 0.18 (spring 2022): Python 2.7, 3.1–3.10
* Spack 0.19 (fall 2022): Python 2.7, 3.1–3.6 (deprecated), 3.7–3.11
* Spack 0.20 (spring 2023): Python 3.7–3.11

This is a reboot of #28003. See #31824 for a detailed discussion of the motivation for this PR.
If you have concerns about this change, please comment on #31824.
tgamblin pushed a commit that referenced this pull request Nov 22, 2022
This PR removes [end of life](https://endoflife.date/python) versions of Python from Spack. Specifically, this includes all versions of Python older than 3.7.

See #31824 for rationale. Deprecated in #32615. And #28003.

For anyone using software that relies on Python 2, you have a few options:

* Upgrade the software to support Python 3. The `3to2` tool may get you most of the way there, although more complex libraries may need manual tweaking.
* Add Python 2 as an [external package](https://spack.readthedocs.io/en/latest/build_settings.html#external-packages). Many Python libraries do not support Python 2, but you may be able to add older versions that did once upon a time.
* Use Spack 0.19. Spack 0.19 is the last release to officially support Python 3.6 and older
* Create and maintain your own [custom repository](https://spack.readthedocs.io/en/latest/repositories.html). Basically, you would need a package for Python 2 and any other Python 2-specific libraries you need.
amd-toolchain-support pushed a commit to amd-toolchain-support/spack that referenced this pull request Feb 16, 2023
This PR removes [end of life](https://endoflife.date/python) versions of Python from Spack. Specifically, this includes all versions of Python older than 3.7.

See spack#31824 for rationale. Deprecated in spack#32615. And spack#28003.

For anyone using software that relies on Python 2, you have a few options:

* Upgrade the software to support Python 3. The `3to2` tool may get you most of the way there, although more complex libraries may need manual tweaking.
* Add Python 2 as an [external package](https://spack.readthedocs.io/en/latest/build_settings.html#external-packages). Many Python libraries do not support Python 2, but you may be able to add older versions that did once upon a time.
* Use Spack 0.19. Spack 0.19 is the last release to officially support Python 3.6 and older
* Create and maintain your own [custom repository](https://spack.readthedocs.io/en/latest/repositories.html). Basically, you would need a package for Python 2 and any other Python 2-specific libraries you need.
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.

Installation issue: py-pygtk is unsatisfiable