ModuleNotFoundError: No module named 'duplicity.duplicity'

Hello,

So I received this email from MiaB:

Error processing remote manifest (duplicity-inc.20240128T010707Z.to.20240129T010710Z.manifest.gpg): GPG Failed, see log below:
===== Begin GnuPG log =====
gpg: Note: '--decrypt' is not considered an option
gpg: WARNING: no command supplied.  Trying to guess what you mean ...
usage: gpg [options] [filename]
===== End GnuPG log =====

GPGError: GPG Failed, see log below:
===== Begin GnuPG log =====
gpg: Note: '--force-mdc' is not considered an option
gpg: Note: '--symmetric' is not considered an option
gpg: WARNING: no command supplied.  Trying to guess what you mean ...
usage: gpg [options] [filename]
===== End GnuPG log =====

Traceback (most recent call last):
  File "/root/mailinabox/management/backup.py", line 647, in <module>
    perform_backup(full_backup)
  File "/root/mailinabox/management/backup.py", line 318, in perform_backup
    shell('check_call', [
  File "/root/mailinabox/management/utils.py", line 126, in shell
    ret = getattr(subprocess, method)(cmd_args, **kwargs)
  File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/duplicity', 'incr', '--verbosity', 'warning', '--no-print-statistics', '--archive-dir', '/home/user-data/backup/cache', '--exclude', '/home/user-data/backup', '--volsize', '250', '--gpg-options', "'--cipher-algo=AES256'", '--allow-source-mismatch', '/home/user-data', 'file:///home/user-data/backup/encrypted']' returned non-zero exit status 31.

Googling, I found this thread:
https://discourse.mailinabox.email/t/backup-script-failing/10734/46?page=3

I did the following things:

$ sudo apt-mark unhold duplicity
$ sudo apt update
$ sudo apt upgrade
$ sudo /root/mailinabox/management/backup.py

Traceback (most recent call last):
  File "/usr/bin/duplicity", line 33, in <module>
    sys.exit(load_entry_point('duplicity==2.2.1', 'console_scripts', 'duplicity')())
  File "/usr/bin/duplicity", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'duplicity.duplicity'
Something is wrong with the backup: 

Following that thread, I ran:

$ sudo apt purge python3-future
$ sudo apt-get purge duplicity
$ sudo apt-get reinstall python3
$ sudo apt-get reinstall duplicity

Problem is I get this:

$ duplicity --version
Traceback (most recent call last):
  File "/usr/bin/duplicity", line 33, in <module>
    sys.exit(load_entry_point('duplicity==2.2.1', 'console_scripts', 'duplicity')())
  File "/usr/bin/duplicity", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'duplicity.duplicity'

Obviously my backups don’t work. I need to fix this. Please help.

There is an open issue regarding this problem here

Follow @mokiejovis instructions here to solve your problem.

It is advised to not upgrade to the new Duplicity version 2.2.1 for now.