L'API YunoHost ne répond pas - moulinette.interfaces.api is not a package

What type of hardware are you using: Virtual machine
What YunoHost version are you running: 12.0
How are you able to access your server: The webadmin
SSH

Describe your issue

Bonjour,
je viens de découvrir une mise à jour pour monter yunohost en v12.1, mais en lançant celle-ci cela a cassé mon installation : “L’API YunoHost ne répond pas”
Erreur: “502”
Action: “GET” /yunohost/api/installed
Mais en console il m’indique que le paquet yunohost-api : “1 not fully installed or removed.”
Et si je veux installer un paquet en ssh j’ai le message joint.

Merci beaucoup de l’aide !

Share relevant logs or error messages

Traceback (most recent call last):
File “/usr/lib/python3.11/logging/config.py”, line 391, in resolve
self.importer(used)
ModuleNotFoundError: No module named ‘moulinette.interfaces.api.APIQueueHandler’; ‘moulinette.interfaces.api’ is not a package

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/lib/python3.11/logging/config.py”, line 562, in configure
handler = self.configure_handler(handlers[name])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/logging/config.py”, line 724, in configure_handler
klass = self.resolve(cname)
^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/logging/config.py”, line 396, in resolve
raise v from e
ValueError: Cannot resolve ‘moulinette.interfaces.api.APIQueueHandler’: No module named ‘moulinette.interfaces.api.APIQueueHandler’; ‘moulinette.interfaces.api’ is not a package

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/bin/yunohost”, line 108, in
main()
File “/usr/bin/yunohost”, line 97, in main
yunohost.cli(
File “/usr/lib/python3/dist-packages/yunohost/init.py”, line 35, in cli
init_logging(interface=“cli”, debug=debug, quiet=quiet)
File “/usr/lib/python3/dist-packages/yunohost/init.py”, line 194, in init_logging
configure_logging(logging_configuration)
File “/usr/lib/python3/dist-packages/moulinette/utils/log.py”, line 86, in configure_logging
dictConfig(logging_config)
File “/usr/lib/python3.11/logging/config.py”, line 812, in dictConfig
dictConfigClass(config).configure()
File “/usr/lib/python3.11/logging/config.py”, line 569, in configure
raise ValueError('Unable to configure handler ’
ValueError: Unable to configure handler ‘api’
dpkg: error processing package yunohost (–configure):
installed yunohost package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
yunohost
E: Sub-process /usr/bin/dpkg returned an error code (1)

Hello,

J’ai le même problème depuis la dernière mise à jour.
Plus d’infos:

systemctl status yunohost-api retourne:


● yunohost-api.service - YunoHost API Server
     Loaded: loaded (/etc/systemd/system/yunohost-api.service; enabled; preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Wed 2025-03-19 11:01:49 UTC; 3s ago
    Process: 1563820 ExecStart=/usr/bin/yunohost-api (code=exited, status=1/FAILURE)
   Main PID: 1563820 (code=exited, status=1/FAILURE)
        CPU: 90ms

systemctl is-enabled yunohost-api:

enabled

journalctl -u yunohost-api --no-pager --lines=50:

Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:   File "/usr/bin/yunohost-api", line 71, in <module>
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:     yunohost.api(debug=opts.debug, host=opts.host, port=opts.port)
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:   File "/usr/lib/python3/dist-packages/yunohost/__init__.py", line 60, in api
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:     init_logging(interface="api", debug=debug)
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:   File "/usr/lib/python3/dist-packages/yunohost/__init__.py", line 209, in init_logging
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:     configure_logging(logging_configuration)
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:   File "/usr/lib/python3/dist-packages/moulinette/utils/log.py", line 86, in configure_logging
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:     dictConfig(logging_config)
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:   File "/usr/lib/python3.11/logging/config.py", line 812, in dictConfig
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:     dictConfigClass(config).configure()
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:   File "/usr/lib/python3.11/logging/config.py", line 569, in configure
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:     raise ValueError('Unable to configure handler '
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]: ValueError: Unable to configure handler 'api'
Mar 19 11:06:28 hosty.nohost.me systemd[1]: yunohost-api.service: Main process exited, code=exited, status=1/FAILURE
Mar 19 11:06:28 hosty.nohost.me systemd[1]: yunohost-api.service: Failed with result 'exit-code'.
Mar 19 11:06:33 hosty.nohost.me systemd[1]: yunohost-api.service: Scheduled restart job, restart counter is at 26229.
Mar 19 11:06:33 hosty.nohost.me systemd[1]: Stopped yunohost-api.service - YunoHost API Server.
Mar 19 11:06:33 hosty.nohost.me systemd[1]: Started yunohost-api.service - YunoHost API Server.
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]: Traceback (most recent call last):
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:   File "/usr/lib/python3.11/logging/config.py", line 391, in resolve
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:     self.importer(used)
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]: ModuleNotFoundError: No module named 'moulinette.interfaces.api.APIQueueHandler'; 'moulinette.interfaces.api' is not a package
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]: The above exception was the direct cause of the following exception:
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]: Traceback (most recent call last):
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:   File "/usr/lib/python3.11/logging/config.py", line 562, in configure
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:     handler = self.configure_handler(handlers[name])
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:   File "/usr/lib/python3.11/logging/config.py", line 724, in configure_handler
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:     klass = self.resolve(cname)
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:             ^^^^^^^^^^^^^^^^^^^
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:   File "/usr/lib/python3.11/logging/config.py", line 396, in resolve
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:     raise v from e
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]: ValueError: Cannot resolve 'moulinette.interfaces.api.APIQueueHandler': No module named 'moulinette.interfaces.api.APIQueueHandler'; 'moulinette.interfaces.api' is not a package
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]: The above exception was the direct cause of the following exception:
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]: Traceback (most recent call last):
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:   File "/usr/bin/yunohost-api", line 71, in <module>
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:     yunohost.api(debug=opts.debug, host=opts.host, port=opts.port)
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:   File "/usr/lib/python3/dist-packages/yunohost/__init__.py", line 60, in api
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:     init_logging(interface="api", debug=debug)
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:   File "/usr/lib/python3/dist-packages/yunohost/__init__.py", line 209, in init_logging
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:     configure_logging(logging_configuration)
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:   File "/usr/lib/python3/dist-packages/moulinette/utils/log.py", line 86, in configure_logging
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:     dictConfig(logging_config)
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:   File "/usr/lib/python3.11/logging/config.py", line 812, in dictConfig
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:     dictConfigClass(config).configure()
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:   File "/usr/lib/python3.11/logging/config.py", line 569, in configure
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:     raise ValueError('Unable to configure handler '
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]: ValueError: Unable to configure handler 'api'
Mar 19 11:06:33 hosty.nohost.me systemd[1]: yunohost-api.service: Main process exited, code=exited, status=1/FAILURE
Mar 19 11:06:33 hosty.nohost.me systemd[1]: yunohost-api.service: Failed with result 'exit-code'.

yunohost tools diagnosis:

Traceback (most recent call last):
  File "/usr/lib/python3.11/logging/config.py", line 391, in resolve
    self.importer(used)
ModuleNotFoundError: No module named 'moulinette.interfaces.api.APIQueueHandler'; 'moulinette.interfaces.api' is not a package

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.11/logging/config.py", line 562, in configure
    handler = self.configure_handler(handlers[name])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/logging/config.py", line 724, in configure_handler
    klass = self.resolve(cname)
            ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/logging/config.py", line 396, in resolve
    raise v from e
ValueError: Cannot resolve 'moulinette.interfaces.api.APIQueueHandler': No module named 'moulinette.interfaces.api.APIQueueHandler'; 'moulinette.interfaces.api' is not a package

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/bin/yunohost", line 108, in <module>
    main()
  File "/usr/bin/yunohost", line 97, in main
    yunohost.cli(
  File "/usr/lib/python3/dist-packages/yunohost/__init__.py", line 35, in cli
    init_logging(interface="cli", debug=debug, quiet=quiet)
  File "/usr/lib/python3/dist-packages/yunohost/__init__.py", line 194, in init_logging
    configure_logging(logging_configuration)
  File "/usr/lib/python3/dist-packages/moulinette/utils/log.py", line 86, in configure_logging
    dictConfig(logging_config)
  File "/usr/lib/python3.11/logging/config.py", line 812, in dictConfig
    dictConfigClass(config).configure()
  File "/usr/lib/python3.11/logging/config.py", line 569, in configure
    raise ValueError('Unable to configure handler '
ValueError: Unable to configure handler 'api'

Can you share the output of dpkg --list | grep 'yunohost\|moulinette'

Thanks for your anwser.

Here is the output of dpkg --list | grep ‘yunohost|moulinette’:

ii  moulinette                            12.0.4+202501201615                          all          prototype interfaces with ease in Python
iF  yunohost                              12.0.12                                      all          manageable and configured self-hosting server
ii  yunohost-admin                        12.0.5+202502112115                          all          web administration interface for yunohost
ii  yunohost-portal                       12.0.8                                       all          user portal designed for yunohost