[DOC] Add --no-binary to reinstall command
Without this option pillow-simd will not be recompiled if it is already installed. Adding --no-binary pillow-simd forces the recompile.
I'm not sure if this is the correct branch, contributors guide says to make PRs to master, but I don't see a master branch in the repo.
Could you describe the case more precisely? I'm trying the following:
$ pip uninstall pillow
Cannot uninstall requirement pillow, not installed
$ pip uninstall pillow-simd
Cannot uninstall requirement pillow-simd, not installed
$ pip install pillow-simd
Collecting pillow-simd
Using cached Pillow-SIMD-5.1.1.post0.tar.gz
Installing collected packages: pillow-simd
Running setup.py install for pillow-simd ... done
Successfully installed pillow-simd-5.1.1.post0
$ ./run.py scale
Scale 2560×1600 RGB image
to 26x16 bil 0.00347 s 1181.07 Mpx/s
to 26x16 bic 0.00666 s 614.84 Mpx/s
to 26x16 lzs 0.01033 s 396.55 Mpx/s
to 320x200 bil 0.00479 s 855.87 Mpx/s
to 320x200 bic 0.00758 s 540.59 Mpx/s
to 320x200 lzs 0.01271 s 322.27 Mpx/s
to 2048x1280 bil 0.01488 s 275.21 Mpx/s
to 2048x1280 bic 0.02163 s 189.34 Mpx/s
to 2048x1280 lzs 0.02927 s 139.94 Mpx/s
to 5478x3424 bil 0.07110 s 57.61 Mpx/s
to 5478x3424 bic 0.09565 s 42.82 Mpx/s
to 5478x3424 lzs 0.13172 s 31.10 Mpx/s
$ CC="cc -mavx2" pip install -U --force-reinstall pillow-simd
Collecting pillow-simd
Using cached Pillow-SIMD-5.1.1.post0.tar.gz
Installing collected packages: pillow-simd
Found existing installation: Pillow-SIMD 5.1.1.post0
Uninstalling Pillow-SIMD-5.1.1.post0:
Successfully uninstalled Pillow-SIMD-5.1.1.post0
Running setup.py install for pillow-simd ... done
Successfully installed pillow-simd-5.1.1.post0
$ ./run.py scale
Scale 2560×1600 RGB image
to 26x16 bil 0.00270 s 1518.73 Mpx/s
to 26x16 bic 0.00457 s 896.65 Mpx/s
to 26x16 lzs 0.00720 s 568.89 Mpx/s
to 320x200 bil 0.00344 s 1189.00 Mpx/s
to 320x200 bic 0.00573 s 715.08 Mpx/s
to 320x200 lzs 0.00905 s 452.75 Mpx/s
to 2048x1280 bil 0.01281 s 319.63 Mpx/s
to 2048x1280 bic 0.01638 s 250.09 Mpx/s
to 2048x1280 lzs 0.02355 s 173.91 Mpx/s
to 5478x3424 bil 0.05099 s 80.32 Mpx/s
to 5478x3424 bic 0.06853 s 59.77 Mpx/s
to 5478x3424 lzs 0.09499 s 43.12 Mpx/s
As you can see, recompilation works.
@homm I see, thanks for checking this. For me, the output of the reinstall command is slightly different:
CC="ccfasdfad -mavx2" pip install -U --force-reinstall pillow-simd
Collecting pillow-simd
Installing collected packages: pillow-simd
Found existing installation: Pillow-SIMD 5.1.1.post0
Uninstalling Pillow-SIMD-5.1.1.post0:
Successfully uninstalled Pillow-SIMD-5.1.1.post0
Successfully installed pillow-simd-5.1.1.post0
As you can see, it does not have Running setup.py install for pillow-simd ... done and also it succeeds despite using a bogus CC value.
I think the reason for this is the following, here is the output of the first pip install command:
pip install -U --force-reinstall pillow-simd
Collecting pillow-simd
Downloading Pillow-SIMD-5.1.1.post0.tar.gz (14.2MB)
100% |████████████████████████████████| 14.2MB 103kB/s
Building wheels for collected packages: pillow-simd
Running setup.py bdist_wheel for pillow-simd ... done
Stored in directory: /Users/kostia/Library/Caches/pip/wheels/58/45/cf/aaf3e1db66c24e3350e3a2ad9bd6dfbd574ede6d613ba321bf
Successfully built pillow-simd
Installing collected packages: pillow-simd
Successfully installed pillow-simd-5.1.1.post0
As you can see, the wheel is cached ( Stored in directory: /Users/kostia/Library/Caches/pip/wheels/58/45/cf/aaf3e1db66c24e3350e3a2ad9bd6dfbd574ede6d613ba321bf) and this wheel is re-used on re-installation, unless --no-binary is passed. This cache is on by default in pip I think: https://pip.pypa.io/en/stable/reference/pip_install/#caching
I had to do the same as @lopuhin reported - only with adding the no-binary flag it recompiles properly and the performance tests improve significantly.