scikit-image / scikit-image

Image processing in Python
https://scikit-image.org
Other
6.06k stars 2.22k forks source link

allow Pillow-SIMD as alternative to Pillow in requirements #4387

Open zt-initech opened 4 years ago

zt-initech commented 4 years ago

Description

The requirements lists Pillow>=4.3.0, please make it accept Pillow-SIMD as an alternative.

Since Pillow-SIMD and Pillow both install into the PIL directory, they are mutually exclusive.

Way to reproduce

$ sudo apt-get install zlib1g-dev libjpeg-turbo8-dev libjpeg8-dev libwebp-dev
$ pip install Pillow-SIMD
Collecting Pillow-SIMD
  Using cached https://files.pythonhosted.org/packages/b1/19/b7043190f481abb94dcdd1e69c4432432aaa73455cf1128eae39b8eb2518/Pillow-SIMD-6.0.0.post0.tar.gz
Installing collected packages: Pillow-SIMD
    Running setup.py install for Pillow-SIMD ... done
Successfully installed Pillow-SIMD-6.0.0.post0
$ pip install scikit-image
Collecting pillow>=4.3.0
  Downloading https://files.pythonhosted.org/packages/f5/79/b2d5695d1a931474fa68b68ec93bdf08ba9acbc4d6b3b628eb6aac81d11c/Pillow-7.0.0-cp37-cp37m-manylinux1_x86_64.whl (2.1MB)
Installing collected packages: pillow
Successfully installed pillow-7.0.0

Version information

# Paste the output of the following python commands
from __future__ import print_function
import sys; print(sys.version)
import platform; print(platform.platform())
import skimage; print("scikit-image version: {}".format(skimage.__version__))
import numpy; print("numpy version: {}".format(numpy.__version__))
# your output here
3.7.6 (default, Dec 19 2019, 23:50:13) 
[GCC 7.4.0]
Linux-5.0.0-37-generic-x86_64-with-Ubuntu-18.04-bionic
scikit-image version: 0.15.0
numpy version: 1.16.2
hmaarrfk commented 4 years ago

I'm glad to take a patch that would allow this to happen. I'm not sure how the tests would fair without pillow installed.

Honestly, to me, the real ask would be for pillow-smd to install in an alternative directory.

If they could both be installed at the same time, it would be trivial for us to add it as a new backend and potentially make the case that it should be default.

You are going to fight an uphill battle getting this to work without a change in pillow-smd.

Finally, you can likely create your own conda channel and package that does not depend on pillow, but rather pillow-smd and use conda for your projects

soupault commented 4 years ago

I am not sure if there is an easy way to address this on our side. It seems that the corresponding functionality for setup.py never got accepted - https://www.python.org/dev/peps/pep-0426/#alternative-dependencies . Conditional dependencies are available only for Python-/system-level markers - https://www.python.org/dev/peps/pep-0508/.

Why is there such a mess around PIL anyways? 😄 Cannot they "just" have everything in a single package?

hmaarrfk commented 4 years ago

As a workaround, you may use the --no-deps flag. Not fun, but can work if you need to test things.