So not lucky, but I found a way to get it back to work:
First I tried to understand and fix the error messages:
setuptools-rust 1.5.2 requires setuptools>=62.4, but you have setuptools 60.8.2 which is incompatible.
AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'
I found an elderly problem with similar structure:
and then tried:
$ sudo pip install pip --upgrade
$ sudo pip install pyopenssl --upgrade
$ sudo pip install setuptools --upgrade
$ sudo pip install setuptools-rust --upgrade
but that only resulted in
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
So, I’m not familiar with those virtual environments and it didn’t change anything.
The solution was to adopt the path to the archive to the correct file:
$ sudo tar --delete --file /home/yunohost.backup/archives/synapse-pre-upgrade1.tar apps/synapse/backup/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/pyOpenSSL-22.0.0.dist-info/
$ sudo tar --delete --file /home/yunohost.backup/archives/synapse-pre-upgrade1.tar apps/synapse/backup/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/OpenSSL/
So I lost my crypto keys and my verification (and all the encrypted messages), but at least the contacts seems to be there.
Christian