Annif icon indicating copy to clipboard operation
Annif copied to clipboard

Python 3.12 support

Open juhoinkinen opened this issue 11 months ago • 5 comments

Python 3.12 was released last October, so we should try to support it in Annif.

Currently support is not possible because of the following (to be continued...):

  • ~gensim v4.3.2 does not provide a wheel for Python 3.12 in PyPI, and building the wheel locally fails:~

    ...
    gensim/models/word2vec_inner.c:25:10: fatal error: Python.h: No such file or directory
         25 | #include "Python.h"
            |          ^~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
    
    • ~issues https://github.com/piskvorky/gensim/issues/3511, https://github.com/piskvorky/gensim/issues/3510~
  • tensorflow-io-gcs-filesystem requires Python >=3.7, <3.12

    • issues https://github.com/tensorflow/io/issues/1761, https://github.com/tensorflow/io/issues/1966)
  • stwfsapy requires Python <3.12,>=3.9

    • issue https://github.com/zbw/stwfsapy/issues/61

juhoinkinen avatar Mar 21 '24 07:03 juhoinkinen

  • gensim v4.3.2 does not provide a wheel for Python 3.12 in PyPI, and building > the wheel locally fails:

     ...
     gensim/models/word2vec_inner.c:25:10: fatal error: Python.h: No such file or directory
          25 | #include "Python.h"
             |          ^~~~~~~~~~
       compilation terminated.
       error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
    
    • issues https://github.com/piskvorky/gensim/issues/3511, https://github.com/piskvorky/gensim/issues/3510

Actually this was resolved by installing python3.12-dev system package, which was missing from my laptop.

juhoinkinen avatar Mar 21 '24 10:03 juhoinkinen

As gensim can be installed, provided that the python3.12-dev system package is available, even currently it is possible to install Annif (or at least Poetry can resolve dependencies) if the unsupported dependencies are resctricted to Python <3.12, that is using this in pyproject.toml:

tensorflow-cpu = { version = "2.15.*", optional = true, python = "<3.12" }
stwfsapy = { version = "0.4.*", optional = true, python = "<3.12" }

juhoinkinen avatar Mar 21 '24 11:03 juhoinkinen

It looks like Ubuntu 24.04, to be released in April 2024, will come with Python 3.12. So it would be nice if we could support it soon. But of course, older Python versions can also be installed on Ubuntu.

osma avatar Mar 21 '24 11:03 osma

tensorflow-cpu = { version = "2.15.*", optional = true, python = "<3.12" }

Also TensorFlow could be installed, if it could be upgraded to version 2.16.*, but this is blocked by https://github.com/tensorflow/tensorflow/issues/63585.

juhoinkinen avatar Mar 22 '24 12:03 juhoinkinen

Not fully closed, because stwfsapy and NN ensemble do not work on Python 3.12.

juhoinkinen avatar Apr 25 '24 12:04 juhoinkinen

Closed by #796.

juhoinkinen avatar Sep 30 '24 10:09 juhoinkinen