Seahub failed to start - no module named 'Image'

I’m installing seafile on my rpi with python 3.7 but i’m getting the following message on starting the seahub with start-fastcgi.

Traceback (most recent call last):
  File "/home/seafile/installed/seahub/seahub/avatar/models.py", line 23, in <module>
    from PIL import Image
  File "/home/seafile/installed/seahub/thirdpart/PIL/Image.py", line 93, in <module>
    from . import _imaging as core
ImportError: cannot import name '_imaging' from 'PIL' (/home/seafile/installed/seahub/thirdpart/PIL/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/seafile/installed/seahub/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/seafile/installed/seahub/thirdpart/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/home/seafile/installed/seahub/thirdpart/django/core/management/__init__.py", line 338, in execute
    django.setup()
  File "/home/seafile/installed/seahub/thirdpart/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/seafile/installed/seahub/thirdpart/django/apps/registry.py", line 108, in populate
    app_config.import_models()
  File "/home/seafile/installed/seahub/thirdpart/django/apps/config.py", line 202, 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 "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/seafile/installed/seahub/seahub/avatar/models.py", line 26, in <module>
    import Image
ModuleNotFoundError: No module named 'Image'

I installed both Pillow and Image but nothing seems to work. This solution was based on:
seafile topic #10227

What is going wrong, the pi says that the requirement is already satisfied when installing Image and Pillow both for pip and pip3.

I’m not sure it’s the correct way, but my workaround worked for me…

I renamed the folder (in your case)

/home/seafile/installed/seahub/thirdpart/PIL/

to something like
/home/seafile/installed/seahub/thirdpart/PIL.old (in order to be able to restore everything).
This way, python isn’t finding PIL inside the seafile server installation files and looks for the user/system-installed version.

You can give it a try, for me it worked. And if it doesn’t work, just re-rename your folder and nothing changed…

You should try this first

pip3 install -U Pillow -t /media/sda/seafile/seafile-server-latest/seahub/thirdpart

1 Like

Hello,

Sorry for opening again such an old topic, but I’m facing the exact same issue with SeaFile 9.0.2…
Unfortunately none of the workarounds given here worked for me :cry:

Any suggestion ?

Thanks!
Brice

Hi Brice,

I wish I could help you but due the time that has past I cannot remember any longer what the solution was. I’m very sorry for this. Wish you good luck.

Though, as I Failed to do so, I’d as you to post an answer here if you do figure it out such that others may not find themselves in the situation we were both in.

1 Like

What system are you using?
Did you do a fresh install of 9.0.2 or upgraded an existing installation? (If you upgraded, what was the last working version?)
Without any additional information, I doubt anyone will be able to help you.

You’re right @squirrel , sorry…
I posted also on another topic so I forgot to mention some points.
I’m using a Raspberry PI 3 running Raspberry Pi OS Buster.
I’m trying a fresh install of 9.0.2.

I did a little digging in the seahub.sh script, where I found that the path to PYTHON packages is wrong, because it is searching for <install_path>/seafile/lib64/python3, where there is no lib64 folder.
So I modified the script to target the correct path, but after that I’m facing another issue which is the following one:

Traceback (most recent call last):
  File "/seafile/seafile-server-9.0.2/check_init_admin.py", line 19, in <module>
    from seaserv import ccnet_api
ModuleNotFoundError: No module named 'seaserv'

I’m a bit lost here… :frowning:

This is so frustrating… :angry:

If I modify the script to set the PYTHONPATH to
${INSTALLPATH}/seafile/lib/python3/site-packages
I’m then getting the error mentionned here with the module ‘Image’ not found, but if I modify the script that way:
${INSTALLPATH}/seafile/lib/python3.7/site-packages
it is bypassing the search for Image (or doesn’t reach it I don’t know), and I get the error module seaserv not found…

:exploding_head:

I don’t have a buster system and I don’t know exactly what’s going on, but I saw that the error you posted in the other thread included:

ImportError: libopenjp2.so.7: cannot open shared object file: No such file or directory

Did you install libopenjpg2-7 (didn’t check what the correct package name for buster is) or something along those lines providing the file? Not sure whether this is necessary or not and whether this in included in the guide you used.

Tbh: I don’t recall exactly whether I had to install the library and I’m not sure it helps, but I figure it’s worth a try.

Good catch !
I’ve installed libopenjp2-7, and then I got this:
Unknown command: 'runfcgi'
:thinking:
Then tried by launching normally seahub with the start option, instead of start-fastcgi as it is suggested when something goes wrong, and yeah ! It works ! :hugs:
Thanks a lot ! The answer was in front of my noze, couldn’t see it :stuck_out_tongue_closed_eyes:

start-fastcgi is deprecated. But (I don’t know why) it gives a more verbose output than the regular start before it itself fails (due to being deprecated). That’s why you get the “unknown command runfcgi”

Glad you got it working.

Thank you a lot, I´ve had the exact same issue with upgrading to 9.0.2.