Seahub fails to start - cffi issue

After upgrading to server version 9.0.9 my seahub refuses to start with the below error related to cffi. I have installed version 1.15 of cffi as the 1.14.0 refuses to build on ubuntu 22.

LC_ALL is not set in ENV, set to en_US.UTF-8
Starting seahub (fastcgi) at 127.0.0.1:8000 ...
Traceback (most recent call last):
  File "/opt/seafile/seafile-server-9.0.9/seahub/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/seafile/seafile-server-9.0.9/seahub/thirdpart/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/opt/seafile/seafile-server-9.0.9/seahub/thirdpart/django/core/management/__init__.py", line 395, in execute
    django.setup()
  File "/opt/seafile/seafile-server-9.0.9/seahub/thirdpart/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/opt/seafile/seafile-server-9.0.9/seahub/thirdpart/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/opt/seafile/seafile-server-9.0.9/seahub/thirdpart/django/apps/config.py", line 301, in import_models
    self.models_module = import_module(models_module_name)
  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 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/opt/seafile/seafile-server-9.0.9/seahub/thirdpart/registration/models.py", line 13, in <module>
    from seahub.base.accounts import User
  File "/opt/seafile/seafile-server-9.0.9/seahub/seahub/base/accounts.py", line 28, in <module>
    from seahub.share.models import ExtraSharePermission
  File "/opt/seafile/seafile-server-9.0.9/seahub/seahub/share/models.py", line 19, in <module>
    from seahub.utils.hasher import AESPasswordHasher
  File "/opt/seafile/seafile-server-9.0.9/seahub/seahub/utils/hasher.py", line 4, in <module>
    from Crypto.Cipher import AES
  File "/usr/local/lib/python3.10/dist-packages/Crypto/Cipher/__init__.py", line 27, in <module>
    from Crypto.Cipher._mode_ecb import _create_ecb_cipher
  File "/usr/local/lib/python3.10/dist-packages/Crypto/Cipher/_mode_ecb.py", line 29, in <module>
    from Crypto.Util._raw_api import (load_pycryptodome_raw_lib,
  File "/usr/local/lib/python3.10/dist-packages/Crypto/Util/_raw_api.py", line 81, in <module>
    ffi = FFI()
  File "/opt/seafile/seafile-server-9.0.9/seahub/thirdpart/cffi/api.py", line 54, in __init__
    raise Exception("Version mismatch: this is the 'cffi' package version %s, located in %r.  When we import the top-level '_cffi_backend' extension module, we get version %s, located in %r.  The two versions should be equal; check your installation." % (
Exception: Version mismatch: this is the 'cffi' package version 1.14.0, located in '/opt/seafile/seafile-server-9.0.9/seahub/thirdpart/cffi/api.py'.  When we import the top-level '_cffi_backend' extension module, we get version 1.15.1, located in '/usr/local/lib/python3.10/dist-packages/_cffi_backend.cpython-310-x86_64-linux-gnu.so'.  The two versions should be equal; check your installation.

Look at this post, it may help you

thanks, this did the trick for me

python3 -m pip install --force-reinstall --upgrade --target <SOMEWHERE>/seafile-server-9.0.5/seahub/thirdpart cffi==1.14.6

1 Like

This is what I did, but it results in seahub not starting properly an showing an ‘Internal Server Error’ when trying to access the web interface.
My system runs Ubuntu 22.04 (upgraded from 18.04) and the seafile version is CE 9.0.10.
I couldn’t find anything usefull in the log files. Where should I start investigating?

Upgrading to Seafile 10 and upgrading the Python dependencies solved the problem.