Python error on all yunohost commands (and webadmin)

My YunoHost server

Hardware: Online VPS
YunoHost version: 11.2.10
I have access to my server: ssh and webadmin

Description of my issue

Hello I recently installed a python package (malojaserver) via pip as root and it completely broke my Yunohost installation
I tried uninstalling all python related package via apt as well as yunohost and reinstalled yunohost
sso/ldap login is working but I can;t use webadmin (“YunoHost API is not responding”) nor the yunohost command
I searched for similar errors on the Yunohost forum and did the steps that fixed the errors, but in my case it’s still broken

Here is the error message:

Can you help me ?

Traceback (most recent call last):
  File "/usr/lib/python3.9/logging/config.py", line 389, in resolve
    found = getattr(found, frag)
AttributeError: module 'moulinette.interfaces' has no attribute 'api'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/logging/config.py", line 564, in configure
    handler = self.configure_handler(handlers[name])
  File "/usr/lib/python3.9/logging/config.py", line 722, in configure_handler
    klass = self.resolve(cname)
  File "/usr/lib/python3.9/logging/config.py", line 391, in resolve
    self.importer(used)
  File "/usr/lib/python3/dist-packages/moulinette/interfaces/api.py", line 12, in <module>
    from gevent import sleep
  File "/usr/lib/python3/dist-packages/gevent/__init__.py", line 86, in <module>
    from gevent._hub_local import get_hub
  File "/usr/lib/python3/dist-packages/gevent/_hub_local.py", line 101, in <module>
    import_c_accel(globals(), 'gevent.__hub_local')
  File "/usr/lib/python3/dist-packages/gevent/_util.py", line 148, in import_c_accel
    mod = importlib.import_module(cname)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "src/gevent/_hub_local.py", line 1, in init gevent._gevent_c_hub_local
ValueError: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 152 from C header, got 144 from PyObject

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

Traceback (most recent call last):
  File "/usr/bin/yunohost", line 77, in <module>
    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 168, in init_logging
    configure_logging(logging_configuration)
  File "/usr/lib/python3/dist-packages/moulinette/utils/log.py", line 67, in configure_logging
    dictConfig(logging_config)
  File "/usr/lib/python3.9/logging/config.py", line 809, in dictConfig
    dictConfigClass(config).configure()
  File "/usr/lib/python3.9/logging/config.py", line 571, in configure
    raise ValueError('Unable to configure handler '
ValueError: Unable to configure handler 'api'

I checked the version of greenlet with both pip and dpkg

➜  magikh pip3 freeze | grep greenlet
greenlet==3.0.3
➜  magikh dpkg --list | grep greenlet
ii  python3-greenlet                      0.4.17-1+b1                                        amd64        Lightweight in-process concurrent programming (python3)

The pip version is newer than the one installed aith dpkg/apt so I uninstalled this one (pip)

Now I have access to yunohost webadmin and command but it tells me:

Error: It looks like you're trying to re-postinstall a system that was already working previously ... If you recently had some bug or issues with your installation, please first discuss with the team on how to fix the situation instead of savagely re-running the postinstall ...

ldap authentication and installed apps are still working

touch /etc/yunohost/installed fixed it !
So to recap for future users that might encounter this problem:

  • I Installed a python package (malojaserver) via pip
  • It broke my Yunohost installation (yunohost command and webadmin, ldap authentication and apps are still working)
  • I tried reinstalling all python related packages and yunohost via apt
  • Still not working
  • I thought the error was reated to gevent while it was related to greenlet
  • dpkg and pip greenlet version mismatched
➜  magikh pip3 freeze | grep greenlet
greenlet==3.0.3
➜  magikh dpkg --list | grep greenlet
ii  python3-greenlet                      0.4.17-1+b1                                        amd64        Lightweight in-process concurrent programming (python3)
  • Uninstalling the pip version while keeping the dpkg
    pip uninstall greenlet
  • Yunohost works again ! But It wants me to to the post-install and when I try it tells me it It looks like you're trying to re-postinstall a system that was already working previously
  • touch /etc/yunohost/installed fixed this problem and now everything works !
2 Likes