when i am trying to install Pillow in my virtualenv i get the following error:
>(django-project1)pk@pk-900X3C-900X3D-900X4C-900X4D:~/Work/django-project1$ pip install -U Pillow
Downloading/unpacking Pillow
Downloading Pillow-2.2.1.zip (2.2MB): 2.2MB downloaded
Running setup.py egg_info for package Pillow
>Installing collected packages: Pillow
Running setup.py install for Pillow
> building 'PIL._imaging' extension
i686-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_LIBJPEG -DHAVE_LIBZ -I/usr/include/freetype2 -IlibImaging -I/usr/local/include -I/usr/include -I/usr/include/python3.3m -I/home/pk/Work/django-project1/include/python3.3m -c _imaging.c -o build/temp.linux-i686-3.3/_imaging.o
_imaging.c:76:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'i686-linux-gnu-gcc' failed with exit status 1
Complete output from command /home/pk/Work/django-project1/bin/python3 -c "import setuptools;__file__='/home/pk/Work/django-project1/build/Pillow/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-bx7vwp-record/install-record.txt --single-version-externally-managed --install-headers /home/pk/Work/django-project1/include/site/python3.3:
running install
>running build
>running build_py
>creating build
>creating build/lib.linux-i686-3.3
>creating build/lib.linux-i686-3.3/PIL
>copying PIL/ImageFile.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ArgImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/PSDraw.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImageFont.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/PsdImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/BmpImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/SpiderImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/FpxImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/FliImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImtImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImageChops.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/SunImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/GimpPaletteFile.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImageMath.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/TiffImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/EpsImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/IcnsImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImageColor.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/PixarImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImageGrab.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImageMode.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/PcfFontFile.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/PcdImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImageOps.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/GdImageFile.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/PngImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/TgaImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImageSequence.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImageWin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/MicImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/JpegImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/McIdasImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImageFilter.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImageFileIO.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImagePalette.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/XpmImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/IptcImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/FontFile.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/GribStubImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/GbrImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/TarIO.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImageTk.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/PalmImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/Image.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/WmfImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ContainerIO.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/tests.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImageStat.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/WebPImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImageEnhance.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/TiffTags.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/DcxImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImageCms.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/OleFileIO.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/__init__.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/SgiImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/JpegPresets.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/XbmImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/_util.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/_binary.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/BdfFontFile.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImageTransform.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/FitsStubImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/PdfImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ExifTags.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/XVThumbImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/IcoImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/BufrStubImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/PpmImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImagePath.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/Hdf5StubImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImageDraw2.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImageDraw.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/GifImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/PcxImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/MpegImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImageQt.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/MspImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/GimpGradientFile.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/PaletteFile.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/ImageShow.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/WalImageFile.py -> build/lib.linux-i686-3.3/PIL
>copying PIL/CurImagePlugin.py -> build/lib.linux-i686-3.3/PIL
>running egg_info
>writing Pillow.egg-info/PKG-INFO
>writing top-level names to Pillow.egg-info/top_level.txt
>writing dependency_links to Pillow.egg-info/dependency_links.txt
>warning: manifest_maker: standard file '-c' not found
>reading manifest file 'Pillow.egg-info/SOURCES.txt'
>reading manifest template 'MANIFEST.in'
>writing manifest file 'Pillow.egg-info/SOURCES.txt'
>running build_ext
>building 'PIL._imaging' extension
>creating build/temp.linux-i686-3.3/libImaging
>i686-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_LIBJPEG -DHAVE_LIBZ -I/usr/include/freetype2 -IlibImaging -I/usr/local/include -I/usr/include -I/usr/include/python3.3m -I/home/pk/Work/django-project1/include/python3.3m -c _imaging.c -o build/temp.linux-i686-3.3/_imaging.o
>_imaging.c:76:20: fatal error: Python.h: No such file or directory
> #include "Python.h"
> ^
>compilation terminated.
>error: command 'i686-linux-gnu-gcc' failed with exit status 1
>----------------------------------------
>Cleaning up...
>Command /home/pk/Work/django-project1/bin/python3 -c "import setuptools;__file__='/home/pk/Work/django-project1/build/Pillow/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-bx7vwp-record/install-record.txt --single-version-externally-managed --install-headers /home/pk/Work/django-project1/include/site/python3.3 failed with error code 1 in /home/pk/Work/django-project1/build/Pillow
Storing complete log in /home/pk/.pip/pip.log
What could be causing the issue? I also have issues installing PIL separately in the virtualenv:
>(django-project1)pk@pk-900X3C-900X3D-900X4C-900X4D:~/Work/django-project1/shop$ pip install PIL
>Downloading/unpacking PIL
> You are installing a potentially insecure and unverifiable file. Future versions of pip >will default to disallowing insecure files.
> Downloading PIL-1.1.7.tar.gz (506kB): 506kB downloaded
> Running setup.py egg_info for package PIL
> Traceback (most recent call last):
> File "<string>", line 16, in <module>
> File "/home/pk/Work/django-project1/build/PIL/setup.py", line 182
> print "--- using Tcl/Tk libraries at", TCL_ROOT
> ^
> SyntaxError: invalid syntax
> Complete output from command python setup.py egg_info:
> Traceback (most recent call last):
>
> File "<string>", line 16, in <module>
>
> File "/home/pk/Work/django-project1/build/PIL/setup.py", line 182
>
> print "--- using Tcl/Tk libraries at", TCL_ROOT
>
> ^
>
>SyntaxError: invalid syntax
>
>----------------------------------------
>Cleaning up...
>Command python setup.py egg_info failed with error code 1 in /home/pk/Work/django-project1/build/PIL
>Storing complete log in /home/pk/.pip/pip.log
but it seems that without virtualenv sourced the PIL is installing ok.
Go to your windows command prompt (by going to the start menu and typing 'cmd') and type "pip install pillow". If that doesn't work, try "pip3 install pillow".
In 2011, PIL has been discontinued—its unofficial successor framework Pillow for image processing is an actively maintained and user-friendly alternative for Python 3.
To load the image, we simply import the image module from the pillow and call the Image. open(), passing the image filename. Instead of calling the Pillow module, we will call the PIL module as to make it backward compatible with an older module called Python Imaging Library (PIL).
I have exactly the same problem and it is a result of the python-dev being for python2 on the default ubuntu (13.10 in my case).
To get around this you need to:
sudo apt-get install python3-dev
Correct Command:
sudo apt-get install python3-dev
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With