简体   繁体   中英

Python Pillow CentOS 7 install errors

I have a python project that installs Pillow==8.4.0 . In local testing when building with Docker, it works fine

# Dockerfile
ARG PIP_CMD='pip install --no-cache-dir'

ARG APK_ADD='apk add --no-cache'

# PIL packages
ARG PIL_PKGS='jpeg-dev zlib-dev libjpeg'

ARG PKGS='git libpq openssh-client'

# development packages that will be installed before pip is run and purged after
ARG DEV_PKGS='linux-headers postgresql-dev python3-dev gcc g++ musl-dev libpng-dev libressl-dev libffi-dev'

$PIP_CMD --upgrade 'pip<20.3' && \
    if ! $PIP_CMD -r requirements.txt; then $APK_ADD $PKGS $PIL_PKGS && $APK_ADD --virtual .build-deps $DEV_PKGS && $PIP_CMD -r requirements.txt && apk del .build-deps; fi ...

We use python3.6 setup.py bdist_rpm to build the project as a rpm which then gets installed on a centos7 box. The install of the rpm fails because it says the project is missing dependencies (pillow deps, it seems):

# yum install project-1.0

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: download.cf.centos.org
 * epel: iad.mirror.rackspace.com
 * extras: download.cf.centos.org
 * updates: download.cf.centos.org
Resolving Dependencies
--> Running transaction check
---> Package project-1.0.x86_64 0:1.0.29.dev0-1.202201181623.el7 will be updated
---> Package project-1.0.x86_64 0:1.0.29.dev0-1.202201181700.el7 will be an update
--> Processing Dependency: libjpeg-183418da.so.9.4.0(LIBJPEG_9.0)(64bit) for package: project-1.0-1.0.29.dev0-1.202201181700.el7.x86_64
--> Processing Dependency: liblzma-d540a118.so.5.2.5(XZ_5.0)(64bit) for package: project-1.0-1.0.29.dev0-1.202201181700.el7.x86_64
--> Processing Dependency: libpng16-213e245f.so.16.37.0(PNG16_0)(64bit) for package: project-1.0-1.0.29.dev0-1.202201181700.el7.x86_64
--> Processing Dependency: libz-dd453c56.so.1.2.11(ZLIB_1.2.3.4)(64bit) for package: project-1.0-1.0.29.dev0-1.202201181700.el7.x86_64
--> Processing Dependency: libz-dd453c56.so.1.2.11(ZLIB_1.2.9)(64bit) for package: project-1.0-1.0.29.dev0-1.202201181700.el7.x86_64
--> Finished Dependency Resolution
Error: Package: project-1.0-1.0.29.dev0-1.202201181700.el7.x86_64 (project-yum)
           Requires: libjpeg-183418da.so.9.4.0(LIBJPEG_9.0)(64bit)
Error: Package: project-1.0-1.0.29.dev0-1.202201181700.el7.x86_64 (project-yum)
           Requires: libz-dd453c56.so.1.2.11(ZLIB_1.2.9)(64bit)
Error: Package: project-1.0-1.0.29.dev0-1.202201181700.el7.x86_64 (project-yum)
           Requires: libpng16-213e245f.so.16.37.0(PNG16_0)(64bit)
Error: Package: project-1.0-1.0.29.dev0-1.202201181700.el7.x86_64 (project-yum)
           Requires: liblzma-d540a118.so.5.2.5(XZ_5.0)(64bit)
Error: Package: project-1.0-1.0.29.dev0-1.202201181700.el7.x86_64 (project-yum)
           Requires: libz-dd453c56.so.1.2.11(ZLIB_1.2.3.4)(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

I can successfully install Pillow directly on the box by:

python3 -m pip install Pillow

Collecting Pillow
  Using cached Pillow-8.4.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB)
Installing collected packages: Pillow
Successfully installed Pillow-8.4.0

I have also tried installing the dependencies specified here https://pillow.readthedocs.io/en/stable/installation.html

yum install zlib libjpeg

And still see the above error when installing project-1.0

I've also tried symlinking some *.so files from /usr/lib64/... to /usr/lib/... as suggested here: PIL /JPEG Library: "decoder jpeg not available" but no luck..

Any suggestions on what to try next?

When installing Pillow==8.4.0, these libraries are located at

/your_venv/lib/python3.6/site-packages/Pillow.libs/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM