Upgrading Seafile fails at Python module installation with pip3

Written by - 0 comments

Published on - Listed in Seafile Linux Python


Upgrading Seafile (when in use over several years) requires additional thinking and upgrade planning, because:

  • Up to version 7.0, Seafile was using Python2 in the background
  • Starting with version 7.1, Seafile is using Python3
  • Python2 packages have been removed in Debian 11 (Bullseye)

This means if you want to upgrade your Seafile server from version 7.0 or earlier, you need to do this on an operating system/release which offers both Python2 and Python3 support. Debian 10 (Buster) is the last Debian release which offers full Python2 support, yet also offers full Python3 (3.7) support.

Upgrade path

The upgrade path to get your outdated Seafile to a recent version (9.0.8 is currently the newest release) on a Debian Linux, is therefore something like this:

  • Upgrade OS to Debian 10, if not already done
  • Upgrade Seafile < 7.0 to 7.0
  • Upgrade Seafile from 7.0 to 7.1
  • Upgrade OS to Debian 11
  • Upgrade Seafile to more recent version

Problems installing Python modules through pip3

The Seafile 7.0 to 7.1 upgrade documentation mentions the installation of several Python3 packages, using both apt and pip3 (Python's own package installation tool):

Python3 packages required for Seafile 7.1

While the apt packages were installed fine, the pip3 packages fail to install:

root@seafile~# pip3 install --timeout=3600 Pillow pylibmc captcha jinja2 sqlalchemy==1.3.8 django-pylibmc django-simple-captcha python3-ldap
Collecting Pillow
[...]
    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-icrvn39g/Pillow/setup.py", line 1015, in <module>
        raise RequiredDependencyException(msg)
    __main__.RequiredDependencyException:

    The headers or library files could not be found for zlib,
    a required dependency when compiling Pillow from source.

    Please see the install instructions at:
       https://pillow.readthedocs.io/en/latest/installation.html

The installation fails and mentions that the (development) headers for the zlib library could not be found. These can be installed using apt:

root@seafile:~# apt-get install zlib1g-dev

But after this, another error showed up at the end:

root@seafile:~# pip3 install --timeout=3600 Pillow pylibmc captcha jinja2 sqlalchemy==1.3.8 django-pylibmc django-simple-captcha python3-ldap
Collecting Pillow
[...]
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-72km_1f0/Pillow/setup.py", line 1015, in <module>
        raise RequiredDependencyException(msg)
    __main__.RequiredDependencyException:

    The headers or library files could not be found for jpeg,
    a required dependency when compiling Pillow from source.

    Please see the install instructions at:
       https://pillow.readthedocs.io/en/latest/installation.html

Alright, this time the jpeg development headers are missing. Install them as well:

root@seafile:~# apt-get install libjpeg62-turbo-dev

Run the pip3 command again:

root@seafile:~# pip3 install --timeout=3600 Pillow pylibmc captcha jinja2 sqlalchemy==1.3.8 django-pylibmc django-simple-captcha python3-ldap
Collecting Pillow
[...]
    writing manifest file 'src/Pillow.egg-info/SOURCES.txt'
    running build_ext
    building 'PIL._imaging' extension
    creating build/temp.linux-x86_64-3.7
    creating build/temp.linux-x86_64-3.7/src
    building 'PIL._imagingmath' extension
    creating build/temp.linux-x86_64-3.7/src/libImaging
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include -I/usr/local/include -I/usr/include/python3.7m -c src/_imagingmath.c -o build/temp.linux-x86_64-3.7/src/_imagingmath.o
    building 'PIL._imagingmorph' extension
    unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include -I/usr/local/include -I/usr/include/python3.7m -c src/_imagingmorph.c -o build/temp.linux-x86_64-3.7/src/_imagingmorph.o
    unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
    building 'PIL._imagingtk' extension
    creating build/temp.linux-x86_64-3.7/src/Tk
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include -I/usr/local/include -I/usr/include/python3.7m -c src/_imagingtk.c -o build/temp.linux-x86_64-3.7/src/_imagingtk.o
    unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_LIBJPEG -DHAVE_LIBZ -DPILLOW_VERSION="9.2.0" -I/usr/include -I/usr/local/include -I/usr/include/python3.7m -c src/_imaging.c -o build/temp.linux-x86_64-3.7/src/_imaging.o
    unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1


    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-u1qt_b1z/Pillow/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-v1udz6aa/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-u1qt_b1z/Pillow/

Ugh, another error. This time the error mentions an issue with gcc. Let's install two additional packages: The Python development package and the build-essential package. The latter contains a lot of program compiling tools, such as the mentioned gcc.

root@seafile:~# apt-get install python3.7-dev build-essential

root@seafile:~# pip3 install --timeout=3600 Pillow pylibmc captcha jinja2 sqlalchemy==1.3.8 django-pylibmc django-simple-captcha python3-ldap
Collecting Pillow
[...]
Installing collected packages: Pillow, pylibmc, captcha, MarkupSafe, jinja2, sqlalchemy, django-pylibmc, typing-extensions, asgiref, pytz, sqlparse, Django, django-ranged-response, django-simple-captcha, pyasn1, python3-ldap
  Running setup.py install for Pillow ... done
  Running setup.py install for pylibmc ... done
  Running setup.py install for MarkupSafe ... done
  Running setup.py install for sqlalchemy ... done
  Running setup.py install for django-ranged-response ... done
Successfully installed Django-3.2.15 MarkupSafe-2.1.1 Pillow-9.2.0 asgiref-3.5.2 captcha-0.4 django-pylibmc-0.6.1 django-ranged-response-0.2.0 django-simple-captcha-0.5.17 jinja2-3.1.2 pyasn1-0.4.8 pylibmc-1.6.3 python3-ldap-0.9.8.4 pytz-2022.2.1 sqlalchemy-1.3.8 sqlparse-0.4.2 typing-extensions-4.3.0

Finally the required Python modules were installed.

TL;DR: You need more packages than documented

Before upgrading to Seafile 7.1, you need to install more packages than mentioned in the documentation:

root@seafile:~# apt-get install python3 python3-setuptools python3-pip memcached libmemcached-dev python3.7-dev build-essential zlib1g-dev libjpeg62-turbo-dev



Add a comment

Show form to leave a comment

Comments (newest first)

No comments yet.

RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder