Raspberry Pi 2: Seahub error at startup after upgrading to Seafile Server 8.0.5


When upgrading my Raspberry Pi 2 running Debian 10, I got an error when starting seahub.
The error is now already resolved but I would still like to share the answer here for other users.

Unfortunately there was also no specific error message shown but with this hint starting with fastcgi altough not needed I got more details about the error:

LC_ALL is not set in ENV, set to en_US.UTF-8
./seahub.sh: line 210: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory
Starting seahub (fastcgi) at …
Traceback (most recent call last):
File β€œ/home/seafile/haiwen/seafile-server-8.0.7/seahub/seahub/avatar/models.py”, line 23, in
from PIL import Image
File β€œ/home/seafile/haiwen/seafile-server-8.0.7/seahub/thirdpart/PIL/Image.py”, line 114, in
from . import _imaging as core
ImportError: libopenjp2.so.7: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File β€œ/home/seafile/haiwen/seafile-server-8.0.7/seahub/manage.py”, line 10, in
File β€œ/home/seafile/haiwen/seafile-server-8.0.7/seahub/thirdpart/django/core/management/init.py”, line 381, in execute_from_command_line
File β€œ/home/seafile/haiwen/seafile-server-8.0.7/seahub/thirdpart/django/core/management/init.py”, line 357, in execute
File β€œ/home/seafile/haiwen/seafile-server-8.0.7/seahub/thirdpart/django/init.py”, line 24, in setup
File β€œ/home/seafile/haiwen/seafile-server-8.0.7/seahub/thirdpart/django/apps/registry.py”, line 114, in populate
File β€œ/home/seafile/haiwen/seafile-server-8.0.7/seahub/thirdpart/django/apps/config.py”, line 211, in import_models
self.models_module = import_module(models_module_name)
File β€œ/usr/lib/python3.7/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File β€œβ€, line 1006, in _gcd_import
File β€œβ€, line 983, in _find_and_load
File β€œβ€, line 967, in _find_and_load_unlocked
File β€œβ€, line 677, in _load_unlocked
File β€œβ€, line 728, in exec_module
File β€œβ€, line 219, in _call_with_frames_removed
File β€œ/home/seafile/haiwen/seafile-server-8.0.7/seahub/seahub/avatar/models.py”, line 26, in
import Image
ModuleNotFoundError: No module named β€˜Image’
Error:Seahub failed to start.

With this information I found out that the line from PIL import Image at seahub/seahub/avatar/models.py causes this error. Pillow itself was installed so I got curious and when trying the same thing directly in Python3, it shows the following error which finally guided me to the right place:

>>> from PIL import Image
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/dist-packages/PIL/Image.py", line 94, in <module>
    from . import _imaging as core
ImportError: libopenjp2.so.7: cannot open shared object file: No such file or directory

After I installed the missing library simply with sudo apt install libopenjp2-7 I could successfully start seahub and my seafile installation is now working properly.
I don’t know why I hadn’t this library installed but maybe this is also a thing to add at the update documentation for Raspberry Pi 2.

Additionally, Python PyMySQL was missing but only later I realized that this was actually written in the announcement that Seafile Server 8.0.3 for Raspberry Pi is ready.

As explained above, I already found the solution to my answer which is to install the following missing library:

sudo apt install libopenjp2-7
1 Like