0

I'm trying to install PIL on OSX 10.6.8 using pip in virtualenv, but it fails with gcc returning 1 exit status.

here's what i get:

$ pip install PIL
Downloading/unpacking PIL
  Running setup.py egg_info for package PIL
    WARNING: '' not a valid package name; please use only.-separated package names in setup.py
Installing collected packages: PIL
  Running setup.py install for PIL
    WARNING: '' not a valid package name; please use only.-separated package names in setup.py
    --- using frameworks at /System/Library/Frameworks
    building '_imaging' extension
    gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -DHAVE_LIBJPEG -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -I/opt/local/include/freetype2 -IlibImaging -I/opt/local/include -I/Users/DataGreed/workspaces/vitrualenv/project/include -I/usr/local/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _imaging.c -o build/temp.macosx-10.6-universal-2.6/_imaging.o
    _imaging.c:3017: warning: initialization from incompatible pointer type
    _imaging.c:3077: warning: initialization from incompatible pointer type
    /usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/as/ppc/as or /usr/bin/../local/libexec/as/ppc/as) for architecture ppc not installed
    Installed assemblers are:
    /usr/bin/../libexec/as/x86_64/as for architecture x86_64
    /usr/bin/../libexec/as/i386/as for architecture i386
    /usr/bin/../libexec/as/arm/as for architecture arm
    _imaging.c:3017: warning: initialization from incompatible pointer type
    _imaging.c:3077: warning: initialization from incompatible pointer type
    _imaging.c:3281: fatal error: error writing to -: Broken pipe
    compilation terminated.
    _imaging.c:3017: warning: initialization from incompatible pointer type
    _imaging.c:3077: warning: initialization from incompatible pointer type
    lipo: can't open input file: /var/folders/sO/sODPLYP7Goy5NCFskrL1dE+++TM/-Tmp-//ccds0vgZ.out (No such file or directory)
    error: command 'gcc-4.2' failed with exit status 1
    Complete output from command /Users/DataGreed/workspaces/vitrualenv/project/bin/python -c "import setuptools;__file__='/Users/DataGreed/workspaces/vitrualenv/project/build/PIL/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/sO/sODPLYP7Goy5NCFskrL1dE+++TM/-Tmp-/pip-BNAuaC-record/install-record.txt --single-version-externally-managed --install-headers /Users/DataGreed/workspaces/vitrualenv/project/bin/../include/site/python2.6:
    WARNING: '' not a valid package name; please use only.-separated package names in setup.py

running install

running build

running build_py

running build_ext

--- using frameworks at /System/Library/Frameworks

building '_imaging' extension

gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -DHAVE_LIBJPEG -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -I/opt/local/include/freetype2 -IlibImaging -I/opt/local/include -I/Users/DataGreed/workspaces/vitrualenv/project/include -I/usr/local/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _imaging.c -o build/temp.macosx-10.6-universal-2.6/_imaging.o

_imaging.c:3017: warning: initialization from incompatible pointer type

_imaging.c:3077: warning: initialization from incompatible pointer type

/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/as/ppc/as or /usr/bin/../local/libexec/as/ppc/as) for architecture ppc not installed

Installed assemblers are:

/usr/bin/../libexec/as/x86_64/as for architecture x86_64

/usr/bin/../libexec/as/i386/as for architecture i386

/usr/bin/../libexec/as/arm/as for architecture arm

_imaging.c:3017: warning: initialization from incompatible pointer type

_imaging.c:3077: warning: initialization from incompatible pointer type

_imaging.c:3281: fatal error: error writing to -: Broken pipe

compilation terminated.

_imaging.c:3017: warning: initialization from incompatible pointer type

_imaging.c:3077: warning: initialization from incompatible pointer type

lipo: can't open input file: /var/folders/sO/sODPLYP7Goy5NCFskrL1dE+++TM/-Tmp-//ccds0vgZ.out (No such file or directory)

error: command 'gcc-4.2' failed with exit status 1

UPD: on the other computer with the same osx version it installs flawlessly :-/

UPD2: there is a more strange thing actually. I have PIL already installed via pip outside virtualenv. But I cannot install it in virtualenv only.

UPD3: i dunno if it can help, but when I load virtualenv wrapper scripts, i got this:

/Library/Python/2.6/site-packages/stevedore/extension.py:4: UserWarning: Module 

pkg_resources was already imported from /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.pyc, but /Library/Python/2.6/site-packages is being added to sys.path
  import pkg_resources
/Library/Python/2.6/site-packages/stevedore/extension.py:4: UserWarning: Module site was already imported from /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site.pyc, but /Library/Python/2.6/site-packages is being added to sys.path
  import pkg_resources

When I use workon, i get the same warnings.

DataGreed
  • 13,245
  • 8
  • 45
  • 64

2 Answers2

1

Have you tried Pillow? (pip install pillow):

http://pypi.python.org/pypi/Pillow/

It makes life with PIL much easier. I was able to install PIL via Pillow on OSX with virtualenv and virtualenvwrapper.

John Carter
  • 6,752
  • 2
  • 32
  • 53
0

Mine installs fine into a virtualenv on 10.6.8 but...

mine is being built with gcc-4.0 , while yours is being built with 4.2 ; and 4.2 should be the default.

so i don't actually know why mine is being built with gcc-4.0 , but it does work fine.

$ which gcc
/usr/bin/gcc
$ ls -alh /usr/bin/gcc
lrwxr-xr-x  1 root  wheel     7B Jan  3  2012 /usr/bin/gcc -> gcc-4.2
Jonathan Vanasco
  • 15,111
  • 10
  • 48
  • 72
  • well, i can probably change symlink to point to gcc-4.0, but that's a pretty ugly workaround (even if it'll work) – DataGreed Sep 25 '12 at 06:03
  • My gcc symlink points to 4.2 , as shown above. For whatever reason there's something on my computer that Python is reading and making it decide to use 4.0 instead. ( already checked the env vars ) – Jonathan Vanasco Sep 25 '12 at 14:34
  • is there a chance that your virtualenv is using a different version of python ? perhaps the machine with problems is trying to run one Python with config information from another because the installation wasn't clean. Also, take a look at these discussions about general gcc issues with python : http://stackoverflow.com/questions/5944228/python-build-using-wrong-version-of-gcc-on-os-x http://stackoverflow.com/questions/5967065/python-distutils-not-using-correct-version-of-gcc – Jonathan Vanasco Sep 25 '12 at 14:45
  • Thanks. Just checked: the both virtual env. and system environment use Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49); Tried gcc-4.0, but no luck: the same error :( – DataGreed Sep 25 '12 at 16:52
  • i'm out of ideas then :( good luck and let us know if you figure out a fix. – Jonathan Vanasco Sep 25 '12 at 17:50