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

Support python 3.12 #483

Closed
anissa111 opened this issue Oct 3, 2023 · 10 comments · Fixed by #548
Closed

Support python 3.12 #483

anissa111 opened this issue Oct 3, 2023 · 10 comments · Fixed by #548
Assignees
Labels
feature a new feature that is going to be developed

Comments

@anissa111
Copy link
Member

See the 3.12 stable release announcement

@anissa111 anissa111 added the feature a new feature that is going to be developed label Oct 3, 2023
@cyschneck
Copy link
Contributor

There is a Github shield for python packages from PyPi that can make it readable at a glance for the README

https://img.shields.io/pypi/pyversions/geocat-comp

PyPi-Versions

@anissa111 anissa111 self-assigned this Nov 2, 2023
@cyschneck
Copy link
Contributor

cyschneck commented Nov 6, 2023

  • Update documentation to include 3.12 (README.md)
  • Update build environments (setup.cfg, docs.yml, environment.yml)
  • Workflow releases and pytests (ci-release.yml, ci.yml)
  • Check Python 3.12.0 compatibility for existing dependency packages

Incompatible Packages

  • eofs (error running 1.4.0: AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?)
  • numba (error running 0.58.1: RuntimeError: Cannot install on Python version 3.12.0; only versions >=3.8,<3.12 are supported.)
  • xskillscore (error using cached numba 0.58: RuntimeError: Cannot install on Python version 3.12.0; only versions >=3.8,<3.12 are supported)
  • geocat-datafiles

Compatible Packages

  • cf_xarray (running 0.8.6)
  • cftime (running 1.6.3)
  • distributed (running 2023.10.1)
  • metpy (running 1.5.1)
  • numpy (running 1.26.1)
  • pint (running 0.22)
  • xarray (running 2023.10.1)
  • netCDF4 (running 1.6.5)
  • parameterized (running 0.9.0)
  • pytest (running 7.4.3)
  • pytest-cov (running 4.1.0)

@cyschneck
Copy link
Contributor

Numba Python 3.12 support is still a work-in-progress as of numba/numba#9197

Currently throws:

RuntimeError: Cannot install on Python version 3.12.0; only versions >=3.8,<3.12 are supported

@cyschneck cyschneck added the blocked Work got blocked waiting the output of some other source/work label Nov 7, 2023
@cyschneck
Copy link
Contributor

Numba PR for Python 3.12 support is merged and will be packaged with the upcoming Numba 0.59 release

@kafitzgerald
Copy link
Contributor

kafitzgerald commented Nov 28, 2023

I expressed a bit of concern about dropping 3.9 earlier (we generally drop a version when we support a new one), but I think I've been swayed by the guidance laid out in SPEC0 and adoption of that by the major scientific packages. And npl-2023b has made it to Python 3.10 at least.

Here's the related xarray convo about version support and a link to SPEC 0.

Might be worth a bit of conversation about trying to follow SPEC 0 guidance, but this particular move should get us closer anyway.

See also NEP-29 which seems to be what xarray follows. This would mean continuing to support Python 3.9 through spring of 2024.

@cyschneck
Copy link
Contributor

Numba on a code freeze until January 14th. Release candidate 0.59.0rc1 will add Python 3.12

@anissa111
Copy link
Member Author

If you install the release candidate and run the tests locally, does everything work?

@cyschneck
Copy link
Contributor

I will give it a look

@cyschneck
Copy link
Contributor

The release candidate is looking good, but won't be able to test against the full testing suite until eofs is updated to work with 3.12 as well

$ pip install eofs
Collecting eofs
  Using cached eofs-1.4.0.tar.gz (1.0 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      /tmp/pip-install-jlchx2g0/eofs_bd6309de443d4c75b63ad3c4db8f197b/versioneer.py:421: SyntaxWarning: invalid escape sequence '\s'
        LONG_VERSION_PY['git'] = '''
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-jlchx2g0/eofs_bd6309de443d4c75b63ad3c4db8f197b/setup.py", line 38, in <module>
          version=versioneer.get_version(),
                  ^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-install-jlchx2g0/eofs_bd6309de443d4c75b63ad3c4db8f197b/versioneer.py", line 1480, in get_version
          return get_versions()["version"]
                 ^^^^^^^^^^^^^^
        File "/tmp/pip-install-jlchx2g0/eofs_bd6309de443d4c75b63ad3c4db8f197b/versioneer.py", line 1412, in get_versions
          cfg = get_config_from_root(root)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-install-jlchx2g0/eofs_bd6309de443d4c75b63ad3c4db8f197b/versioneer.py", line 342, in get_config_from_root
          parser = configparser.SafeConfigParser()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?
      [end of output]

Same reason a pip install of geocat-comp on python3.12 isn't currently possible

$ pip install geocat.comp
Collecting geocat.comp
  Downloading geocat.comp-2023.3.1-py3-none-any.whl (43 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 43.9/43.9 kB 894.0 kB/s eta 0:00:00
Requirement already satisfied: cf-xarray>=0.3.1 in /home/user/miniconda3/envs/geocat_comp_build_312/lib/python3.12/site-packages (from geocat.comp) (0.8.7)
Requirement already satisfied: cftime in /home/user/miniconda3/envs/geocat_comp_build_312/lib/python3.12/site-packages (from geocat.comp) (1.6.3)
Requirement already satisfied: dask[array] in /home/user/miniconda3/envs/geocat_comp_build_312/lib/python3.12/site-packages (from geocat.comp) (2023.12.1)
Collecting eofs (from geocat.comp)
  Using cached eofs-1.4.0.tar.gz (1.0 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      /tmp/pip-install-ve2rfu6t/eofs_205c04cd9326442397bf7a808029cb37/versioneer.py:421: SyntaxWarning: invalid escape sequence '\s'
        LONG_VERSION_PY['git'] = '''
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-ve2rfu6t/eofs_205c04cd9326442397bf7a808029cb37/setup.py", line 38, in <module>
          version=versioneer.get_version(),
                  ^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-install-ve2rfu6t/eofs_205c04cd9326442397bf7a808029cb37/versioneer.py", line 1480, in get_version
          return get_versions()["version"]
                 ^^^^^^^^^^^^^^
        File "/tmp/pip-install-ve2rfu6t/eofs_205c04cd9326442397bf7a808029cb37/versioneer.py", line 1412, in get_versions
          cfg = get_config_from_root(root)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-install-ve2rfu6t/eofs_205c04cd9326442397bf7a808029cb37/versioneer.py", line 342, in get_config_from_root
          parser = configparser.SafeConfigParser()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?
      [end of output]

I'll look into it more now that numba is looking good. There is a current issue open for this eofs issue (ajdawson/eofs#141), but it's a common issue in packages because of the new deprecations in Python 3.12

@cyschneck
Copy link
Contributor

The release for eofs 1.4.1 includes support for Python 3.12

$ pip install eofs
Collecting eofs
  Downloading eofs-1.4.1-py3-none-any.whl.metadata (3.6 kB)
Requirement already satisfied: numpy in /home/user/miniconda3/envs/geocat_comp_build_12/lib/python3.12/site-packages (from eofs) (1.26.3)
Downloading eofs-1.4.1-py3-none-any.whl (1.1 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 3.9 MB/s eta 0:00:00
Installing collected packages: eofs
Successfully installed eofs-1.4.1

$ python
Python 3.12.1 | packaged by conda-forge | (main, Dec 23 2023, 08:03:24) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import eofs
>>>

@cyschneck cyschneck added feature a new feature that is going to be developed and removed feature a new feature that is going to be developed blocked Work got blocked waiting the output of some other source/work labels Feb 2, 2024
@cyschneck cyschneck mentioned this issue Feb 5, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a new feature that is going to be developed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants