I tried to install the latest version of Pillow on Windows through Cygwin with pip install Pillow
, but I get the error message:
In file included from _imagingtk.c:19:0:
/usr/include/tk.h:76:23: fatal error: X11/Xlib.h: No such file or directory
# include <X11/Xlib.h>
^
compilation terminated.
In file included from Tk/tkImaging.c:52:0:
/usr/include/tk.h:76:23: fatal error: X11/Xlib.h: No such file or directory
# include <X11/Xlib.h>
^
compilation terminated.
Building using 8 processes
gcc -shared -Wl,--enable-auto-image-base -L. build/temp.cygwin-1.7.30-x86_64-2.7/_imagingtk.o build/temp.cygwin-1.7.30-x86_64-2.7/Tk/tkImaging.o -L/usr/lib
-L/usr/lib/python2.7/config -L/usr/local/lib -L/usr/lib/python2.7/config -ltcl8.5 -ltk8.5 -lpython2.7 -o build/lib.cygwin-1.7.30-x86_64-2.7/PIL/_imagingtk.dll
gcc: error: build/temp.cygwin-1.7.30-x86_64-2.7/_imagingtk.o: No such file or directory
gcc: error: build/temp.cygwin-1.7.30-x86_64-2.7/Tk/tkImaging.o: No such file or directory
error: command 'gcc' failed with exit status 1
---------------------------------------- Cleaning up... Command /usr/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip_build_User /pillow/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-7Gv1dT-record/install-record.txt
--single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_User/pillow
Traceback (most recent call last): File "/usr/bin/pip", line 11, in <module>
sys.exit(main()) File "/usr/lib/python2.7/site-packages/pip/__init__.py", line 185, in main
return command.main(cmd_args) File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 35: ordinal not in range(128)
It's failing because it can't find X11, which is particularly confusing because I'm on a Windows computer and X11 is Linux software. I don't like relying on the precompiled version because there is no support.
As always, the answer here is to ditch Cygwin and use a better shell.