Seafile server 7.1.0 is ready for testing! Migrate to Python 3

While I am welcoming the changes python 3 and the rewritten admin interface,
I am not so much the removal of postgres support.
Is this gone for good or as in former case will come back in the future?

After upgrade from 7.0.5 CE to 7.1.0, Seahub fails to start with

Starting seahub at port 8000 ...
!!! WARNING: configuration file should have a valid Python extension.

Seafile server on the other hand is up and running.

Python3 is installed:

seafile@mysrv:~/seafile-server-latest$ python3 -V
Python 3.5.3

What should I do?

Could you elaborate? I was not aware that Seafile Server - CE or PE - has supported PostgreSQL.

It is only a warning by the gunicorn library. We will write an instruction on how to resolve it soon.

Thanks for your quick response. But a warning shouldn’t result in a failed start, should it? :thinking:

Error:Seahub failed to start.

Apologies, now I see what you mean. Your comment refers to the first comment in the change log.

My initial response to your comment was linked to this statement made earlier by Jonathan Xu, Seafile’s CTO.

PostgreSQL is never officially supported before. There is no official upgrade scripts for it either. It’s not easy support one more database backend given that Seafile is written in C. Given that there is no many users using it with Seafile, we decided to drop the support from our code base.

as said not that happy, however even if not “supported” there is some documenation for this;

if you no longer plan to support this, any obsolete postgres references in documentation should be marked obsolete,mainly this:
there It says still beta, but not removed and not a warning that it will be removed.

there were from community (not me) scripts to setup and upgrade postgres (version 4 to 6.3)

Hey Martin,

please try to start seahub with: “ start-fastcgi”. I know this is not supported anymore but normally this shows more errors. In my case the error is:
“cannot import Image” or
“cannot import _imaging”

I am still figuring out, why python3 can not import this.
Best regards

Hi Christoph,

thanks for the hint. Now I can see that I got the very same error. But that’s to deep into Python for me. :laughing:

When updating from 7.0.5 I ran into a few errors:

Updating seafile/seahub database ...

[INFO] You are using SQLite3
[INFO] updating seahub database...
Traceback (most recent call last):
  File "/home/<user>/<seafilefolder>/seafile-server-7.1.0/upgrade/", line 384, in <module>
  File "/home/<user>/<seafilefolder>/seafile-server-7.1.0/upgrade/", line 379, in main
  File "/home/<user>/<seafilefolder>/seafile-server-7.1.0/upgrade/", line 275, in update_db
    super(SQLiteDBUpdater, self).update_db()
  File "/home/<user>/<seafilefolder>/seafile-server-7.1.0/upgrade/", line 129, in update_db
  File "/home/<user>/<seafilefolder>/seafile-server-7.1.0/upgrade/", line 299, in update_seahub_sql
    self.apply_sqls(self.seahub_db, sql_path)
  File "/home/<user>/<seafilefolder>/seafile-server-7.1.0/upgrade/", line 289, in apply_sqls
sqlite3.IntegrityError: UNIQUE constraint failed: constance_config.constance_key

Failed to upgrade your database

Checking my sqlite3 db I see the table is configured as such:

sqlite> select * from constance_config_old;

From the script for 7.1.0 upgrade:

ALTER TABLE "constance_config" RENAME TO "constance_config_old";
CREATE TABLE "constance_config" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "constance_key" varchar(255) NOT NULL UNIQUE, "value" text NULL);
INSERT INTO "constance_config" ("id", "constance_key", "value") SELECT "id", "constance_key", "value" FROM "constance_config_old";
DROP TABLE "constance_config_old";

Here it is trying to insert constance_key 4 times since the column name is “key” not “constance_key” and thus fails with the UNIQUE constraint.

I had to drop the empty constance_key table, alter the name of constance_key_old back to constance_key and edit the seahub.sql to change the column it is pulling from for the constance_key_old table.

This allows that step to proceed but then I get:
sqlite3.OperationalError: near “ON”: syntax error

The problematic line is:
DROP INDEX IF EXISTS "drafts_draft_origin_file_uuid_7c003c98_uniq" ON "drafts_draft";

I ended up removing ON "drafts_draft" and that proceeded the upgrade again (having reverted prior to a backup db before upgrade).

then unfortunately ran into a third issue:

sqlite3.OperationalError: near “CONSTRAINT”: syntax error

This is right on the next line:
ALTER TABLE "drafts_draft" ADD CONSTRAINT "drafts_draft_origin_file_uuid_7c003c98_uniq" UNIQUE ("origin_file_uuid");

Where here, this is a limitation being hit on sqlite:

“Only the RENAME TABLE, ADD COLUMN, and RENAME COLUMN variants of the ALTER TABLE command are supported. Other kinds of ALTER TABLE operations such as DROP COLUMN, ALTER COLUMN, ADD CONSTRAINT, and so forth are omitted.”

Seems like the same steps for the first table need to be done here to add this constraint on drafts_draft, aka rename current table to _old, create new table with this unique constraint and add back any data.

Can you please provide an updated sql script that fixes these issues?

For reference, my version of sqlite3 is:
sqlite> select sqlite_version();

edit, for the last issue this seems to be what is needed:

DROP INDEX IF EXISTS “drafts_draft_origin_file_uuid_7c003c98”;
ALTER TABLE “drafts_draft” RENAME TO “drafts_draft_old”;
CREATE TABLE IF NOT EXISTS “drafts_draft” (“id” integer NOT NULL PRIMARY KEY AUTOINCREMENT, “created_at” datetime NOT NULL, “updated_at” datetime NOT NULL, “username” varchar(255) NOT NULL, “origin_repo_id” varchar(36) NOT NULL UNIQUE, “origin_file_version” varchar(100) NOT NULL, “draft_file_path” varchar(1024) NOT NULL, “publish_file_version” varchar(100) NULL, “status” varchar(20) NOT NULL, “origin_file_uuid” char(32) NOT NULL);
INSERT INTO “drafts_draft” (“id”, “created_at”, “updated_at”, “username”,“origin_repo_id”,“origin_file_version”,“draft_file_path”,“publish_file_version”,“status”,“origin_file_uuid”) SELECT “id”, “created_at”, “updated_at”, “username”,“origin_repo_id”,“origin_file_version”,“draft_file_path”,“publish_file_version”,“status”,“origin_file_uuid” FROM “drafts_draft_old”;
DROP TABLE “drafts_draft_old”;
CREATE INDEX “drafts_draft_created_at_e9f4523f” ON “drafts_draft” (“created_at”);
CREATE INDEX “drafts_draft_updated_at_0a144b05” ON “drafts_draft” (“updated_at”);
CREATE INDEX “drafts_draft_username_73e6738b” ON “drafts_draft” (“username”);
CREATE INDEX IF NOT EXISTS “drafts_draft_origin_repo_id_8978ca2c” ON “drafts_draft” (“origin_repo_id”);

I unfortunately do not have data in drafts_draft to confirm.

Edit 2: the upgrade script completed after making the above changes. Unfortunately I hit more issues trying to start the server, seahub fails to start, the only indication of anything is:

!!! WARNING: configuration file should have a valid Python extension.

Here (seahub/thirdpart/gunicorn/app/ it seems to be loading gunicorn.conf and then explicitly checking for it’s extension of .py or .pyc and seems to be failing since it obviously doesn’t match.
Not sure what is wrong here, but I’ve run into too many problems and will just revert to 7.0.5.

Edit 3: To provide at least some info, I had modified and added .conf to the extension check, starting seahub again threw this error:

Failed to read config file: /home/user/server/conf/gunicorn.conf
Traceback (most recent call last):
  File "/home/user/server/seafile-server-7.1.0/seahub/thirdpart/gunicorn/app/", line 111, in get_config_from_filename
    mod = importlib.util.module_from_spec(spec)
  File "<frozen importlib._bootstrap>", line 580, in module_from_spec
AttributeError: 'NoneType' object has no attribute 'loader'

After this I successfully reverted back to 7.0.5 by restoring backup of the DB and running the minor upgrade script in the 7.0.5 upgrade folder.

final edit: I hadn’t read the other responses but the last issue I had is similar. I am on Debian Buster as well with python 3.7.3.


I see you silently removed the page in the published area, but in GitHub it is still there.

I have the same issue with the failed import.
I am on Debian Buster with Python 3.7.3 (amd64 platform)

The Seafile beta shipped with Pillow 6.2.1, which should be compatible with Python 3.7 :thinking:

Starting seahub (fastcgi) at ...
Traceback (most recent call last):
  File "/data/seafile/seafile-server-7.1.0/seahub/seahub/avatar/", line 23, in <module>
    from PIL import Image
  File "/data/seafile/seafile-server-7.1.0/seahub/thirdpart/PIL/", line 90, in <module>
    from . import _imaging as core
ImportError: cannot import name '_imaging' from 'PIL' (/data/seafile/seafile-server-7.1.0/seahub/thirdpart/PIL/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/seafile/seafile-server-7.1.0/seahub/", line 10, in <module>
  File "/data/seafile/seafile-server-7.1.0/seahub/thirdpart/django/core/management/", line 364, in execute_from_command_line
  File "/data/seafile/seafile-server-7.1.0/seahub/thirdpart/django/core/management/", line 338, in execute
  File "/data/seafile/seafile-server-7.1.0/seahub/thirdpart/django/", line 27, in setup
  File "/data/seafile/seafile-server-7.1.0/seahub/thirdpart/django/apps/", line 108, in populate
  File "/data/seafile/seafile-server-7.1.0/seahub/thirdpart/django/apps/", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python3.7/importlib/", 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 "/data/seafile/seafile-server-7.1.0/seahub/seahub/avatar/", line 26, in <module>
    import Image
ModuleNotFoundError: No module named 'Image'
Error:Seahub failed to start.

Looks like 7.1 has been removed from the download server. Can anyone give it to me?

Upload link:

thanks @DerDanilo

Done. Downloading works fine for me.

1 Like

I can still see it on

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Message>The specified key does not exist.</Message>

And going to there is no such key.

This is a CDN issue. We will see how to solve the problem.

1 Like

Hey Manuel,

I had ubuntu 16.04 lts. After an upgrade to ubuntu 18.04, seafile community 7.1 started without any issues.

Best regards


Is there any working being done on the sqlite3 script to fix the clear issues present?