Unexpected Annif downgrade while installing optional tools

32 views
Skip to first unread message

Christoph Poley

unread,
Feb 10, 2025, 6:03:35 AMFeb 10
to Annif Users
Hi,
after the recommended Annif (Version 1.3) installation (https://github.com/NatLibFi/Annif/blob/main/README.md) I installed the optional spaCy analyzer. While, Annif 1.3 got downgraded to Annif 1.2.1:

(annif.1_3_0) ...:/opt/annif$ annif --version
1.3.0
(annif.1_3_0) ...:/opt/annif$ pip install annif[spacy]

...

  Attempting uninstall: connexion
    Found existing installation: connexion 3.2.0
    Uninstalling connexion-3.2.0:
      Successfully uninstalled connexion-3.2.0
  Attempting uninstall: annif
    Found existing installation: annif 1.3.0
    Uninstalling annif-1.3.0:
      Successfully uninstalled annif-1.3.0
Successfully installed annif-1.2.1 annotated-types-0.7.0 blis-0.7.11 catalogue-2.0.10 cloudpathlib-0.20.0 confection-0.1.5 connexion-3.1.0 cymem-2.0.11 huggingface-hub-0.25.2 isodate-0.6.1 langcodes-3.5.0 language-data-1.3.0 marisa-trie-1.2.1 markdown-it-py-3.0.0 mdurl-0.1.2 murmurhash-1.0.12 optuna-4.0.0 preshed-3.0.9 pydantic-2.10.6 pydantic-core-2.27.2 pygments-2.19.1 rdflib-7.0.0 rich-13.9.4 scikit-learn-1.5.2 shellingham-1.5.4 spacy-3.7.5 spacy-legacy-3.0.12 spacy-loggers-1.0.5 srsly-2.5.1 thinc-8.2.5 tomli-2.0.2 typer-0.15.1 wasabi-1.1.3 weasel-0.4.1

[notice] A new release of pip is available: 23.0.1 -> 25.0.1
[notice] To update, run: pip install --upgrade pip
(annif.1_3_0) ...:/opt/annif$ annif --version
1.2.1

Are there any dependencies that I forgot?

Regards,

Christoph

juho.i...@helsinki.fi

unread,
Feb 10, 2025, 8:05:28 AMFeb 10
to Annif Users
Hi Christoph!

This did not reproduce the issue on my machine:

1. python3.12 -m venv annif-venv && source annif-venv/bin/activate
2. pip install --upgrade pip setuptools wheel
3. pip install annif  # installs Annif 1.3
4. pip install annif[spacy]  # retains Annif 1.3

What happens if you try to install Annif with version 1.3 with Spacy in one operation: pip install annif[spacy]==1.3 ?

Just a guess, but maybe the issue is due to a Spacy model on your machine; you could try redownloading (or removing and downloading it if necessary).

-Juho

Christoph Poley

unread,
Feb 10, 2025, 10:04:01 AMFeb 10
to Annif Users
Hi Juho,
I've tried to install Annif with python3.9. Maybe, you can reproduce this problem.
A quick and dirty fix from my point of view was:  pip install --upgrade --force-reinstall annif ... and it works. 

Christoph

Osma Suominen

unread,
Feb 11, 2025, 3:28:28 AMFeb 11
to annif...@googlegroups.com
Hi Christoph,

Was this in a fresh virtual environment, or did you start with an older
install of Annif? Like Juho said, I think it could be that you have
previously installed spaCy language models that require a specific
version of spaCy.

I tried first installing Annif 1.2 with spaCy and the en_core_web_sm
language model (this was using python 3.10):

python3 -m venv venv
. venv/bin/activate
pip install -U pip wheel
pip install annif[spacy]==1.2.*
python -m spacy download en_core_web_sm

Now, "pip list" shows lots of packages including en_core_web_sm, which
is the spaCy English language model I just installed.

Then I tried upgrading to Annif 1.3:

pip install -U annif

and finally adding spaCy support:

pip install annif[spacy]

This didn't downgrade Annif to 1.2 as it did for you, but it produced an
error instead:

ERROR: pip's dependency resolver does not currently take into account
all the packages that are installed. This behaviour is the source of the
following dependency conflicts.
en-core-web-sm 3.7.1 requires spacy<3.8.0,>=3.7.2, but you have spacy
3.8.4 which is incompatible.

So it's not exactly the same situation as yours, but maybe similar. I
recommend that you check what "pip list" says and if you have any older
spaCy language models installed. You should upgrade those so that they
match the spaCy version (Annif 1.3 uses spaCy 3.8).

-Osma



On 10/02/2025 17:04, Christoph Poley wrote:
> Hi Juho,
> I've tried to install Annif with python3.9. Maybe, you can reproduce
> this problem.
> A quick and dirty fix from my point of view was: pip install --upgrade
> --force-reinstall annif ... and it works.
>
> Christoph
>
> juho.i...@helsinki.fi schrieb am Montag, 10. Februar 2025 um 14:05:28 UTC+1:
>
> Hi Christoph!
>
> This did not reproduce the issue on my machine:
>
> 1. python3.12 -m venv annif-venv && source annif-venv/bin/activate
> 2. pip install --upgrade pip setuptools wheel
> 3. pip install annif  # installs Annif 1.3
> 4. pip install annif[spacy]  # retains Annif 1.3
>
> What happens if you try to install Annif with version 1.3 with Spacy
> in one operation: pip install annif[spacy]==1.3 ?
>
> Just a guess, but maybe the issue is due to a Spacy model on your
> machine; you could try redownloading(or removing and downloading it
> if necessary).
>
> -Juho
> On Monday, 10 February 2025 at 13:03:35 UTC+2 c.p...@dnb.de wrote:
>
> Hi,
> after the recommended Annif (Version 1.3) installation
> (https://github.com/NatLibFi/Annif/blob/main/README.md
> <https://github.com/NatLibFi/Annif/blob/main/README.md>) I
> --
> You received this message because you are subscribed to the Google
> Groups "Annif Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to annif-users...@googlegroups.com
> <mailto:annif-users...@googlegroups.com>.
> To view this discussion visit
> https://groups.google.com/d/msgid/annif-users/6dcd74bc-34c8-4390-ab85-9015d6d76390n%40googlegroups.com <https://groups.google.com/d/msgid/annif-users/6dcd74bc-34c8-4390-ab85-9015d6d76390n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
Osma Suominen
D.Sc. (Tech), Information Systems Specialist
National Library of Finland
P.O. Box 15 (Unioninkatu 36)
00014 HELSINGIN YLIOPISTO
Tel. +358 50 3199529
osma.s...@helsinki.fi
http://www.nationallibrary.fi

Osma Suominen

unread,
Feb 12, 2025, 7:08:51 AMFeb 12
to annif...@googlegroups.com
Hi Christoph,

I think I figured out the problem. Annif 1.3 is depending on spaCy
~3.8.4 which officially should support Python 3.9. But there are no
prebuilt wheels (binary packages) for Python 3.9 on PyPI:
https://pypi.org/project/spacy/3.8.4/#files

These were uploaded to PyPI only last week so the situation may still
evolve. If you want to know more, you can ask on the spaCy discussion
forum: https://github.com/explosion/spaCy/discussions

It appears that the spaCy build may have failed:
https://github.com/explosion/spaCy/actions/runs/13119318041

There's not much we can do about this on the Annif side. Of course, we
could release a new 1.3.1 patch release that downgrades the spaCy
dependency a little bit, if it turns out that the 3.8.4 release is
permanently problematic. But I think it's better to wait and see and let
the spaCy folks sort this out.

However, Annif 1.3 is likely going to be the last release that supports
Python 3.9, since some packages that Annif depends on have already
released versions that dropped 3.9 support. Upgrading your Python
version is highly recommended.

-Osma
Message has been deleted

Christoph Poley

unread,
Feb 18, 2025, 2:03:59 AMFeb 18
to Annif Users
Hi Osma,
sorry for my late respons.

Today, I installed Annif with python.3.12 and everthiny works as expected. Thank you for bugfinding.

Have a nice weekend
Christoph

Reply all
Reply to author
Forward
0 new messages