Failed to read info for ****** : Invalid version: '*.*.*~ynh*'

:uk:/:us: My YunoHost server

Hardware: computer
YunoHost version: 11.1.20 (stable)
I have access to my server : Through SSH | through the webadmin | direct access via keyboard / screen
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : yes, I did stuff to pip that I think now I shouldn’t have done.

Description of my issue

When I try to update my system, I have error messages for every apps installed :
The log is exactly the same for every app (only the displayed version changes)

Le catalogue des applications a été mis à jour !
Failed to read info for aeneria : Invalid version: '1.1.6~ynh4'
[repeat for every app …]
Il n'y a rien à faire. Tout est déjà à jour.

:fr: Mon serveur YunoHost

Matériel: ordinateur
Version de YunoHost: 11.1.20 (stable)
J’ai accès à mon serveur : En SSH | Par la webadmin | En direct avec un clavier/écran
Êtes-vous dans un contexte particulier ou avez-vous effectué des modificiations particulières sur votre instance ? : non

Description du problème

Quand j’essaie de mettre à jour mon serveur via l’interface web, j’ai des messages d’erreur pour l’ensemble des applications installées.
Le message est toujours le même, avec juste le nom de l’appli et la version qui change.

Le catalogue des applications a été mis à jour !
Failed to read info for aeneria : Invalid version: '1.1.6~ynh4'
[répéter pour l’ensemble des applications …]
Il n'y a rien à faire. Tout est déjà à jour.

Typically it sounds like you (or something) installed some stuff globally with pip …

Can you tell if you performed some custom/manual install before this started happening, or if you installed one specific app

I did some things when I tried to upgrade Synapse a while ago, here is what I found in my command history :

sudo /opt/yunohost/matrix-synapse/bin/python3 -m pip install --upgrade pip
sudo python3 -m pip install --upgrade pip
sudo su
/usr/bin/python3 -m pip install --upgrade pip
pip list --outdated | grep -Ev "Package|^-" | awk '{print $1}'| while IFS= read -r line ; do pip install "$line" -U ; done
python -m pip install  setuptools==67.8.0

Synapse upgrade failed ant there were logs about sepuptools version being incorrect.
After this, I was able to upgrade Synapse.

Edit : I am pretty sure I did a lot of updates since this, but not 100% sure.

That one looks like the culprit but it’s hard to be sure …

Anyway, let’s try to yolo pip3 uninstall packaging

Found existing installation: packaging 23.1
Uninstalling packaging-23.1:
  Would remove:
    /usr/local/lib/python3.9/dist-packages/packaging-23.1.dist-info/*
    /usr/local/lib/python3.9/dist-packages/packaging/*
Proceed (Y/n)? Y
  Successfully uninstalled packaging-23.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

But same error after that when trying to upgrade apps (I was able to update php)

Let’s also restart the yunohost API :

sudo systemctl restart yunohost-api

It is not happy now :
sudo journalctl -u yunohost-api

juin 09 16:15:59 myserver.fr systemd[1]: Stopping YunoHost API Server...
juin 09 16:15:59 myserver.fr systemd[1]: yunohost-api.service: Succeeded.
juin 09 16:15:59 myserver.fr systemd[1]: Stopped YunoHost API Server.
juin 09 16:15:59 myserver.fr systemd[1]: yunohost-api.service: Consumed 11min 16.225s CPU time.
juin 09 16:15:59 myserver.fr systemd[1]: Started YunoHost API Server.
juin 09 16:16:06 myserver.fr yunohost-api[337531]: Traceback (most recent call last):
juin 09 16:16:06 myserver.fr yunohost-api[337531]:   File "/usr/local/lib/python3.9/dist-packages/bottle.py", line 876, in _handle
juin 09 16:16:06 myserver.fr yunohost-api[337531]:     return route.call(**args)
juin 09 16:16:06 myserver.fr yunohost-api[337531]:   File "/usr/local/lib/python3.9/dist-packages/bottle.py", line 1759, in wrapper
juin 09 16:16:06 myserver.fr yunohost-api[337531]:     rv = callback(*a, **ka)
juin 09 16:16:06 myserver.fr yunohost-api[337531]:   File "/usr/lib/python3/dist-packages/moulinette/interfaces/api.py", line 63, in wrapper
juin 09 16:16:06 myserver.fr yunohost-api[337531]:     return callback(*args, **kwargs)
juin 09 16:16:06 myserver.fr yunohost-api[337531]:   File "/usr/lib/python3/dist-packages/moulinette/interfaces/api.py", line 736, in wrapper
juin 09 16:16:06 myserver.fr yunohost-api[337531]:     return callback(*args, **kwargs)
juin 09 16:16:06 myserver.fr yunohost-api[337531]:   File "/usr/lib/python3/dist-packages/moulinette/interfaces/api.py", line 748, in wrapper
juin 09 16:16:06 myserver.fr yunohost-api[337531]:     return callback(*args, **kwargs)
juin 09 16:16:06 myserver.fr yunohost-api[337531]:   File "/usr/lib/python3/dist-packages/moulinette/interfaces/api.py", line 412, in messages
juin 09 16:16:06 myserver.fr yunohost-api[337531]:     s_id = authenticator.get_session_cookie()["id"]
juin 09 16:16:06 myserver.fr yunohost-api[337531]:   File "/usr/lib/python3/dist-packages/yunohost/authenticators/ldap_admin.py", line 162, in get_session_cookie
juin 09 16:16:06 myserver.fr yunohost-api[337531]:     raise YunohostAuthenticationError("unable_authenticate")
juin 09 16:16:06 myserver.fr yunohost-api[337531]: yunohost.utils.error.YunohostAuthenticationError: Unable to authenticate
juin 09 16:16:09 myserver.fr yunohost-api[337531]: Traceback (most recent call last):
juin 09 16:16:09 myserver.fr yunohost-api[337531]:   File "/usr/lib/python3/dist-packages/moulinette/actionsmap.py", line 545, in process
juin 09 16:16:09 myserver.fr yunohost-api[337531]:     mod = __import__(
juin 09 16:16:09 myserver.fr yunohost-api[337531]:   File "/usr/lib/python3/dist-packages/yunohost/tools.py", line 24, in <module>
juin 09 16:16:09 myserver.fr yunohost-api[337531]:     from packaging import version
juin 09 16:16:09 myserver.fr yunohost-api[337531]: ModuleNotFoundError: No module named 'packaging'
juin 09 16:16:09 myserver.fr yunohost-api[337531]: Traceback (most recent call last):
juin 09 16:16:09 myserver.fr yunohost-api[337531]:   File "/usr/lib/python3/dist-packages/moulinette/actionsmap.py", line 545, in process
juin 09 16:16:09 myserver.fr yunohost-api[337531]:     mod = __import__(
juin 09 16:16:09 myserver.fr yunohost-api[337531]:   File "/usr/lib/python3/dist-packages/yunohost/tools.py", line 24, in <module>
juin 09 16:16:09 myserver.fr yunohost-api[337531]:     from packaging import version
juin 09 16:16:09 myserver.fr yunohost-api[337531]: ModuleNotFoundError: No module named 'packaging'
juin 09 16:16:15 myserver.fr yunohost-api[337531]: Traceback (most recent call last):
juin 09 16:16:15 myserver.fr yunohost-api[337531]:   File "/usr/lib/python3/dist-packages/moulinette/actionsmap.py", line 545, in process
juin 09 16:16:15 myserver.fr yunohost-api[337531]:     mod = __import__(
juin 09 16:16:15 myserver.fr yunohost-api[337531]:   File "/usr/lib/python3/dist-packages/yunohost/tools.py", line 24, in <module>
juin 09 16:16:15 myserver.fr yunohost-api[337531]:     from packaging import version
juin 09 16:16:15 myserver.fr yunohost-api[337531]: ModuleNotFoundError: No module named 'packaging'

Hmokay then let’s run sudo apt install python3-packaging

then re-restart yunohost-api : sudo systemctl restart yunohost-api

Still in error, sorry :frowning_face:

superadmin@myserver î‚° ~ î‚° sudo apt install python3-packaging
[sudo] Mot de passe de superadmin : 
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances... Fait
Lecture des informations d'Ă©tat... Fait      
python3-packaging est déjà la version la plus récente (20.9-2).
python3-packaging passé en « installé manuellement ».
0 mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour.
 superadmin@myserver î‚° ~ î‚° sudo systemctl restart yunohost-api
 superadmin@myserver î‚° ~ î‚° journalctl -u yunohost-api
Hint: You are currently not seeing messages from other users and the system.
      Users in groups 'adm', 'systemd-journal' can see all messages.
      Pass -q to turn off this notice.
-- Journal begins at Thu 2022-10-06 13:58:04 CEST, ends at Sat 2023-06-10 14:41:10 CEST. --
-- No entries --
 superadmin@myserver î‚° ~ î‚° sudo journalctl -u yunohost-api
juin 10 14:41:10 myserver.fr systemd[1]: Stopping YunoHost API Server...
juin 10 14:41:10 myserver.fr systemd[1]: yunohost-api.service: Succeeded.
juin 10 14:41:10 myserver.fr systemd[1]: Stopped YunoHost API Server.
juin 10 14:41:10 myserver.fr systemd[1]: yunohost-api.service: Consumed 1.345s CPU time.
juin 10 14:41:10 myserver.fr systemd[1]: Started YunoHost API Server.
juin 10 14:48:19 myserver.fr yunohost-api[369808]: Traceback (most recent call last):
juin 10 14:48:19 myserver.fr yunohost-api[369808]:   File "/usr/lib/python3/dist-packages/moulinette/actionsmap.py", line 545, in process
juin 10 14:48:19 myserver.fr yunohost-api[369808]:     mod = __import__(
juin 10 14:48:19 myserver.fr yunohost-api[369808]:   File "/usr/lib/python3/dist-packages/yunohost/tools.py", line 24, in <module>
juin 10 14:48:19 myserver.fr yunohost-api[369808]:     from packaging import version
juin 10 14:48:19 myserver.fr yunohost-api[369808]: ModuleNotFoundError: No module named 'packaging'
juin 10 14:48:24 myserver.fr yunohost-api[369808]: Traceback (most recent call last):
juin 10 14:48:24 myserver.fr yunohost-api[369808]:   File "/usr/lib/python3/dist-packages/moulinette/actionsmap.py", line 545, in process
juin 10 14:48:24 myserver.fr yunohost-api[369808]:     mod = __import__(
juin 10 14:48:24 myserver.fr yunohost-api[369808]:   File "/usr/lib/python3/dist-packages/yunohost/tools.py", line 24, in <module>
juin 10 14:48:24 myserver.fr yunohost-api[369808]:     from packaging import version
juin 10 14:48:24 myserver.fr yunohost-api[369808]: ModuleNotFoundError: No module named 'packaging'

(Edit for completeness : you also need pip3 uninstall packaging to actually solve the issue)

Mokay so let’s try to apt install python3-packaging --reinstall

Let’s cross check that ls -l /usr/lib/python3/dist-packages/packaging/ does list a bunch of python files

Then also with python3 -c 'import packaging; print(packaging)'

Everything works again, you rocks !
Thank you a lot !

Here is the command results, just in case :

 randomuser@myserver î‚° ~ î‚° sudo apt install python3-packaging --reinstall
[sudo] Mot de passe de randomuser : 
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances... Fait
Lecture des informations d'Ă©tat... Fait      
0 mis à jour, 0 nouvellement installés, 1 réinstallés, 0 à enlever et 0 non mis à jour.
Il est nécessaire de prendre 33,5 ko dans les archives.
Après cette opération, 0 o d'espace disque supplémentaires seront utilisés.
RĂ©ception de :1 http://debian.univ-tlse2.fr/debian bullseye/main amd64 python3-packaging all 20.9-2 [33,5 kB]
33,5 ko réceptionnés en 1s (53,5 ko/s)       
(Lecture de la base de données... 196832 fichiers et répertoires déjà installés.)
Préparation du dépaquetage de .../python3-packaging_20.9-2_all.deb ...
DĂ©paquetage de python3-packaging (20.9-2) sur (20.9-2) ...
Paramétrage de python3-packaging (20.9-2) ...
 randomuser@myserver î‚° ~ î‚° ls -l /usr/lib/python3/dist-packages/packaging/
total 132
-rw-r--r-- 1 root root   726 29 janv.  2021 __about__.py
-rw-r--r-- 1 root root  1128  2 mai    2020 _compat.py
-rw-r--r-- 1 root root   562 12 déc.   2020 __init__.py
-rw-r--r-- 1 root root  9460 25 janv.  2021 markers.py
drwxr-xr-x 2 root root  4096 11 juin  11:42 __pycache__
-rw-r--r-- 1 root root     0  8 nov.   2019 py.typed
-rw-r--r-- 1 root root  5098 25 janv.  2021 requirements.py
-rw-r--r-- 1 root root 32208 25 janv.  2021 specifiers.py
-rw-r--r-- 1 root root  2022  5 oct.   2019 _structures.py
-rw-r--r-- 1 root root 29528 17 févr.  2021 tags.py
-rw-r--r-- 1 root root  1812  2 mai    2020 _typing.py
-rw-r--r-- 1 root root  4385 29 janv.  2021 utils.py
-rw-r--r-- 1 root root 15974 14 nov.   2020 version.py
 randomuser@myserver î‚° ~ î‚° sudo python3 -c 'import packaging; print(packaging)'
<module 'packaging' from '/usr/lib/python3/dist-packages/packaging/__init__.py'>
 randomuser@myserver î‚° ~ î‚° sudo systemctl restart yunohost-api

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.