Restoring Synapse backup fails due to setuptools conflict

My YunoHost server

Hardware: Old laptop or computer (Dell Optiplex 7050 Micro, 32 GB ram)
YunoHost version: 11.2.10.3 (stable)
I have access to my server : Through SSH
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Description of my issue

I had my server crash on me in November with my SSD ending up failing. I got backups out in time and am now trying to restore my Synapse/Matrix server.

I have put the relevant .tar and .json files back into the correct folder and I am trying to restore from the web admin interface. I get this error message:

2024-03-21 20:09:37,978: DEBUG - + pip3 install --upgrade setuptools==60.8.2 wheel pip
2024-03-21 20:09:38,923: DEBUG - Collecting setuptools==60.8.2
2024-03-21 20:09:38,923: DEBUG -   Obtaining dependency information for setuptools==60.8.2 from https://files.pythonhosted.org/packages/ad/65/7b98718c0ecebbdae5a5251fffc43dd3800ff3d1a6f7cc1aa09cfbcf17a5/setuptools-60.8.2-py3-none-any.whl.metadata
2024-03-21 20:09:39,203: DEBUG -   Downloading setuptools-60.8.2-py3-none-any.whl.metadata (5.9 kB)
2024-03-21 20:09:39,211: DEBUG - Requirement already satisfied: wheel in /opt/yunohost/matrix-synapse/lib/python3.9/site-packages (0.41.2)
2024-03-21 20:09:39,283: DEBUG - Collecting wheel
2024-03-21 20:09:39,284: DEBUG -   Obtaining dependency information for wheel from https://files.pythonhosted.org/packages/7d/cd/d7460c9a869b16c3dd4e1e403cce337df165368c71d6af229a74699622ce/wheel-0.43.0-py3-none-any.whl.metadata
2024-03-21 20:09:39,310: DEBUG -   Downloading wheel-0.43.0-py3-none-any.whl.metadata (2.2 kB)
2024-03-21 20:09:39,313: DEBUG - Requirement already satisfied: pip in /opt/yunohost/matrix-synapse/lib/python3.9/site-packages (23.2.1)
2024-03-21 20:09:39,416: DEBUG - Collecting pip
2024-03-21 20:09:39,416: DEBUG -   Obtaining dependency information for pip from https://files.pythonhosted.org/packages/8a/6a/19e9fe04fca059ccf770861c7d5721ab4c2aebc539889e97c7977528a53b/pip-24.0-py3-none-any.whl.metadata
2024-03-21 20:09:39,442: DEBUG -   Downloading pip-24.0-py3-none-any.whl.metadata (3.6 kB)
2024-03-21 20:09:39,528: DEBUG - Downloading setuptools-60.8.2-py3-none-any.whl (1.1 MB)
2024-03-21 20:09:39,647: DEBUG -    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 9.5 MB/s eta 0:00:00
2024-03-21 20:09:39,673: DEBUG - Downloading wheel-0.43.0-py3-none-any.whl (65 kB)
2024-03-21 20:09:39,677: DEBUG -    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.8/65.8 kB 26.8 MB/s eta 0:00:00
2024-03-21 20:09:39,711: DEBUG - Downloading pip-24.0-py3-none-any.whl (2.1 MB)
2024-03-21 20:09:39,820: DEBUG -    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 20.0 MB/s eta 0:00:00
2024-03-21 20:09:40,180: DEBUG - Installing collected packages: wheel, setuptools, pip
2024-03-21 20:09:40,180: DEBUG -   Attempting uninstall: wheel
2024-03-21 20:09:40,181: DEBUG -     Found existing installation: wheel 0.41.2
2024-03-21 20:09:40,185: DEBUG -     Uninstalling wheel-0.41.2:
2024-03-21 20:09:40,186: DEBUG -       Successfully uninstalled wheel-0.41.2
2024-03-21 20:09:40,226: DEBUG -   Attempting uninstall: setuptools
2024-03-21 20:09:40,227: DEBUG -     Found existing installation: setuptools 68.2.2
2024-03-21 20:09:40,244: DEBUG -     Uninstalling setuptools-68.2.2:
2024-03-21 20:09:40,291: DEBUG -       Successfully uninstalled setuptools-68.2.2
2024-03-21 20:09:40,597: DEBUG -   Attempting uninstall: pip
2024-03-21 20:09:40,598: DEBUG -     Found existing installation: pip 23.2.1
2024-03-21 20:09:40,639: DEBUG -     Uninstalling pip-23.2.1:
2024-03-21 20:09:40,645: DEBUG -       Successfully uninstalled pip-23.2.1
2024-03-21 20:09:41,501: WARNING - 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.
2024-03-21 20:09:41,501: WARNING - setuptools-rust 1.7.0 requires setuptools>=62.4, but you have setuptools 60.8.2 which is incompatible.
2024-03-21 20:09:41,501: DEBUG - Successfully installed pip-24.0 setuptools-60.8.2 wheel-0.43.0
2024-03-21 20:09:41,732: DEBUG - + pip3 install --upgrade cffi ndg-httpsclient psycopg2 lxml jinja2
2024-03-21 20:09:42,094: DEBUG - Requirement already satisfied: cffi in /opt/yunohost/matrix-synapse/lib/python3.9/site-packages (1.15.1)
2024-03-21 20:09:42,330: DEBUG - Collecting cffi
2024-03-21 20:09:42,419: DEBUG -   Downloading cffi-1.16.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB)
2024-03-21 20:09:42,442: DEBUG - Requirement already satisfied: ndg-httpsclient in /opt/yunohost/matrix-synapse/lib/python3.9/site-packages (0.5.1)
2024-03-21 20:09:42,553: DEBUG - Requirement already satisfied: psycopg2 in /opt/yunohost/matrix-synapse/lib/python3.9/site-packages (2.9.7)
2024-03-21 20:09:42,647: DEBUG - Collecting psycopg2
2024-03-21 20:09:42,675: DEBUG -   Downloading psycopg2-2.9.9.tar.gz (384 kB)
2024-03-21 20:09:42,826: DEBUG -      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 384.9/384.9 kB 2.5 MB/s eta 0:00:00
2024-03-21 20:09:42,877: DEBUG -   Preparing metadata (setup.py): started
2024-03-21 20:09:43,069: DEBUG -   Preparing metadata (setup.py): finished with status 'error'
2024-03-21 20:09:43,076: WARNING -   error: subprocess-exited-with-error
2024-03-21 20:09:43,076: DEBUG - 
2024-03-21 20:09:43,076: WARNING -   × python setup.py egg_info did not run successfully.
2024-03-21 20:09:43,077: WARNING -   │ exit code: 1
2024-03-21 20:09:43,077: WARNING -   ╰─> [24 lines of output]
2024-03-21 20:09:43,077: WARNING -       Traceback (most recent call last):
2024-03-21 20:09:43,077: WARNING -         File "<string>", line 2, in <module>
2024-03-21 20:09:43,078: WARNING -         File "<pip-setuptools-caller>", line 34, in <module>
2024-03-21 20:09:43,078: WARNING -         File "/tmp/pip-install-_z69d_jg/psycopg2_48ccede480dd4ffe985ea10ba9362116/setup.py", line 545, in <module>
2024-03-21 20:09:43,078: WARNING -           setup(name="psycopg2",
2024-03-21 20:09:43,078: WARNING -         File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/setuptools/__init__.py", line 155, in setup
2024-03-21 20:09:43,078: WARNING -           return distutils.core.setup(**attrs)
2024-03-21 20:09:43,079: WARNING -         File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 109, in setup
2024-03-21 20:09:43,079: WARNING -           _setup_distribution = dist = klass(attrs)
2024-03-21 20:09:43,079: WARNING -         File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/setuptools/dist.py", line 455, in __init__
2024-03-21 20:09:43,079: WARNING -           _Distribution.__init__(
2024-03-21 20:09:43,080: WARNING -         File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 293, in __init__
2024-03-21 20:09:43,080: WARNING -           self.finalize_options()
2024-03-21 20:09:43,080: WARNING -         File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/setuptools/dist.py", line 845, in finalize_options
2024-03-21 20:09:43,080: WARNING -           for ep in sorted(loaded, key=by_order):
2024-03-21 20:09:43,080: WARNING -         File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/setuptools/dist.py", line 844, in <lambda>
2024-03-21 20:09:43,081: WARNING -           loaded = map(lambda e: e.load(), filtered)
2024-03-21 20:09:43,081: WARNING -         File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2457, in load
2024-03-21 20:09:43,081: WARNING -           self.require(*args, **kwargs)
2024-03-21 20:09:43,081: WARNING -         File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2480, in require
2024-03-21 20:09:43,082: WARNING -           items = working_set.resolve(reqs, env, installer, extras=self.extras)
2024-03-21 20:09:43,082: WARNING -         File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/pkg_resources/__init__.py", line 788, in resolve
2024-03-21 20:09:43,082: WARNING -           raise VersionConflict(dist, req).with_context(dependent_req)
2024-03-21 20:09:43,082: WARNING -       pkg_resources.VersionConflict: (setuptools 60.8.2 (/opt/yunohost/matrix-synapse/lib/python3.9/site-packages), Requirement.parse('setuptools>=62.4'))
2024-03-21 20:09:43,082: WARNING -       [end of output]
2024-03-21 20:09:43,083: DEBUG - 
2024-03-21 20:09:43,083: WARNING -   note: This error originates from a subprocess, and is likely not a problem with pip.
2024-03-21 20:09:43,083: WARNING - error: metadata-generation-failed
2024-03-21 20:09:43,083: DEBUG - 
2024-03-21 20:09:43,083: WARNING - × Encountered error while generating package metadata.
2024-03-21 20:09:43,083: WARNING - ╰─> See above for output.
2024-03-21 20:09:43,084: DEBUG - 
2024-03-21 20:09:43,084: WARNING - note: This is an issue with the package mentioned above, not pip.
2024-03-21 20:09:43,084: WARNING - hint: See above for details.
2024-03-21 20:09:43,174: DEBUG - + ynh_exit_properly
2024-03-21 20:09:43,175: DEBUG - + [[ restore =~ ^install$|^upgrade$|^restore$ ]]
2024-03-21 20:09:43,681: DEBUG - + ynh_clean_setup
2024-03-21 20:09:43,682: DEBUG - + ynh_clean_check_starting
2024-03-21 20:09:43,682: DEBUG - + '[' -n '' ']'
2024-03-21 20:09:43,682: DEBUG - + '[' -n '' ']'
2024-03-21 20:09:44,684: ERROR - Could not restore synapse: An error occured inside the app restore script

Everything is here:
https://paste.yunohost.org/raw/kidutikipu

Trying to just update setuptools with pip install setuptools in a terminal with SSH, I just get Requirement already satisfied: setuptools in /usr/local/lib/python3.9/dist-packages (69.0.2). I had assumed that would be the case, but I did try.

I would really like to get this backup restored. It is not a matter of life or death, but it would make me feel more confident for the future, to know that this can be solved. Thank you all for any help!

hi!

can you try the following commands then start the upgrade again ?

cd /opt/yunohost/matrix-synapse
source bin/activate
python3 -m pip install --upgrade setuptools wheel pip
deactivate

Hi! Thank you for responding. There is no matrix-synapse/ in /opt/yunohost/.

Should I manually unpack the backup before?

Hi. I just revisited this issue again. To be sure: I am trying to restore my Synapse backup, when I get the above error. Any suggestions on how to restore?

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