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.10 #589

Closed
juhoinkinen opened this issue Apr 26, 2022 · 4 comments · Fixed by #592
Closed

Support Python 3.10 #589

juhoinkinen opened this issue Apr 26, 2022 · 4 comments · Fixed by #592
Assignees
Milestone

Comments

@juhoinkinen
Copy link
Member

Ubuntu 22.04, which has been just released, comes with Python 3.10 by default. Annif should fully support Python 3.10.

As reported in annif-users, installing Omikuji and NN backends fail, and also installing Gensim and pycld3 dependencies have some issues:

Omikuji

Current Omikuji does not have a wheel for Python 3.10, so installing Omikuji for Python 3.10 requires installing first cargo, but even after that, there is an error (at least on Docker image python:3.10-slim):

error: failed to parse manifest at `/tmp/pip-install-5yzjqez2/omikuji_cbdca1e9c9fb435e9d32fc4d65a5d33f/c-api/Cargo.toml`
Caused by:
     failed to parse the `edition` key
Caused by:
     this version of Cargo is older than the `2021` edition, and only supports `2015` and `2018` editions.

I'm not sure if this can be handled some way or should it be fixed in Omikuji.

NN ensemble

Python 3.10 support requires TensorFlow 2.8 or later. Apparently due to NumPy version requirements.

Gensim

Current Gensim releases have wheels only for Python 3.6-3.9, but the next release will have wheel for Python 3.10 too. Before next release, for installing Annif on Python 3.10 it is required to have gcc etc. from build-essential package (which is the case for fastText anyway).

pycld3

Also pycld3 has wheels only for Python 3.6-3.9, and installing pycld3 fails with

RuntimeError: The Protobuf compiler, `protoc`, which is required for building this package, could not be found.

Next release of pycld3 should include wheel for Python 3.10.

Other dependencies

Dropping Python 3.7 support would allow upgrading some pinned dependencies.

@juhoinkinen
Copy link
Member Author

juhoinkinen commented Apr 26, 2022

Omikuji

Current Omikuji does not have a wheel for Python 3.10, so installing Omikuji for Python 3.10 requires installing first cargo, but even after that, there is an error (at least on Docker image python:3.10-slim):

error: failed to parse manifest at `/tmp/pip-install-5yzjqez2/omikuji_cbdca1e9c9fb435e9d32fc4d65a5d33f/c-api/Cargo.toml`
Caused by:
     failed to parse the `edition` key
Caused by:
     this version of Cargo is older than the `2021` edition, and only supports `2015` and `2018` editions.

I'm not sure if this can be handled some way or should it be fixed in Omikuji.

Now I managed in installing a newer version of cargo (1.60.0) which works with current Omikuji (the cargo version in apt repository was way too old). Downloading the installation script seems to be the official way, for example in Dockerfile:

FROM python:3.10-slim-bullseye
RUN pip install --upgrade pip setuptools wheel
RUN apt update && apt install curl build-essential -y
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y 
ENV PATH="/root/.cargo/bin:${PATH}"
RUN pip install omikuji

@osma
Copy link
Member

osma commented Apr 26, 2022

Great that you found a solution, but I wonder if it would be better to ask upstream Omikuji to provide wheels for Python 3.10?

@juhoinkinen
Copy link
Member Author

Great that you found a solution, but I wonder if it would be better to ask upstream Omikuji to provide wheels for Python 3.10?

Yes that would be better. I'll make an issue.

@osma
Copy link
Member

osma commented May 27, 2022

Omikuji upstream now provides wheels for Python 3.10 as well, according to this comment

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