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

Python 3.11 support #703

Closed
osma opened this issue May 12, 2023 · 2 comments · Fixed by #727
Closed

Python 3.11 support #703

osma opened this issue May 12, 2023 · 2 comments · Fixed by #727
Assignees
Milestone

Comments

@osma
Copy link
Member

osma commented May 12, 2023

Python 3.11 was released in October 2022. We should aim at supporting it in Annif. Some concrete steps:

  1. Enable running GitHub Actions CI tests under Python 3.11 (most likely in experimental mode i.e. allowed to fail)
  2. Check all the dependencies and see if they work under 3.11
  3. tomllib (PEP 690) is now part of the standard library so we could use that instead of tomli
  4. Fix 3.11 compatibility issues in the Annif codebase, if any

It's quite likely that some libraries we depend on don't yet support 3.11, so there will be a transition period, perhaps with some optional dependencies not working. This happened with 3.10 as well.

Not sure whether this can be done before the 1.0 release, so I'm putting this into the "Long term" milestone for now.

@juhoinkinen
Copy link
Member

juhoinkinen commented Jun 30, 2023

Omikuji does not have a wheel for Python 3.11, so we should probably request to have it. Previously Omikuji maintainer has responded very promptly (#589 (comment)).

However, when I tried to install Omikuji by building wheel on Python 3.11 (essentially just having cargo installed and then running pip install), there was an error by milksnake dependency:

...
        File "/tmp/pip-build-env-nmoyebyz/normal/lib/python3.11/site-packages/milksnake/ffi.py", line 8, in <module>
          _directive_re = re.compile(r'^\s*#.*?$(?m)')
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/re/__init__.py", line 227, in compile
          return _compile(pattern, flags)
                 ^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/re/__init__.py", line 294, in _compile
          p = _compiler.compile(pattern, flags)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/re/_compiler.py", line 743, in compile
          p = _parser.parse(p, flags)
              ^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/re/_parser.py", line 980, in parse
          p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/re/_parser.py", line 455, in _parse_sub
          itemsappend(_parse(source, state, verbose, nested + 1,
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/re/_parser.py", line 841, in _parse
          raise source.error('global flags not at the start '
      re.error: global flags not at the start of the expression at position 9
      [end of output]

A fix for this incompatibility of milksnake for Python 3.11 has been merged, but currently there is no release to include it (see an issue requesting it).

So it's probably better to wait for milksnake release, and only then request Omikuji to have wheel for Python 3.11.

@juhoinkinen
Copy link
Member

TensorFlow v2.11.1 does not have wheel for Python 3.11, but v2.12.0 does have. So upgrading to TF v2.12+ should be done (also) for this reason.

However, there was a conflict with TF 2.12.0 and NumPy 1.24: #683 (comment). Hopefully soon to be released TF 2.13 is compatible with more recent Numpy (1.25.0 was released Jun 17th).

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

Successfully merging a pull request may close this issue.

2 participants