Seafile-Server 11.0.3 on Debian 12 (Bookworm): Seahub can not be started

I got seafile 11 working on Debian 12. I can’t say that the way I did it was the right way, but it worked so it is at least a right way. There are a few things to do differently from the install instructions in the manual.

First off, Debian 12 doesn’t let pip install things into directories managed by the system’s package manager (apt, apt-get, and dpkg). This is a good thing because it makes it harder to break your system, but it does change how you have to do the install. So what I did was to create a python virtual environment (aka a venv, a place to install packages with pip that is separate from the system files). This means that you have to have that venv active when you do the pip install, and when you start seafile and seahub.

So in the manual, don’t do the pip step. Later, after you have created the seafile user, then do these steps (change /opt/seafile to wherever you installed seafile):

su seafile
cd /opt/seafile
# create the vitual environment in the python-venv directory
python3 -m venv python-venv
# activate the venv
source python-venv/bin/activate

Then you can do the pip

pip3 install --timeout=3600  django==3.2.* future==0.18.* mysqlclient==2.1.* pymysql pillow==10.0.* pylibmc captcha==0.4 markupsafe==2.0.1 jinja2 sqlalchemy==2.0.18 psd-tools django-pylibmc django_simple_captcha==0.5.* djangosaml2==1.5.* pysaml2==7.2.* pycryptodome==3.16.* cffi==1.15.1 lxml python-ldap==3.4.3

Then it is basically the same for everything else, except you have to activate the venv before you run seafile or seahub. To have that happen automatically when starting these programs from systemd, I wrote this little wrapper script:

#!/bin/bash
# Activate the python virtual environment (venv) before starting one of the seafile scripts
dir_name="$(dirname $0)"
source "${dir_name}/python-venv/bin/activate"
script="$1"
shift 1
echo "${dir_name}/seafile-server-latest/${script}" "$@"
"${dir_name}/seafile-server-latest/${script}" "$@"

Name that run_with_venv.sh and put it in /opt/seafile (or whatever directory you installed into, it goes above seafile-server-latest). In the systemd unit files, change the ExecStart from

ExecStart=${seafile_dir}/seafile-server-latest/seafile.sh start

to

ExecStart=${seafile_dir}/run_with_venv.sh seafile.sh start

Make that same change also for seahub.

I hope that works for you. I offered edits for the manual to add these changes, but I don’t know if they will be accepted or not. It might be that the developers have already created a different process that they haven’t shared with us yet (or at least not that I could find).