10

I have just completed the xcode install, mac osx lion. Upon completion I attempted to install PIL in a virtual enviroment using pip, easy_install and home brew. All three are erring out. pip install give the following error:

pip `

unable to execute gcc-4.0: No such file or directory

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

`

easy_install unable to execute gcc-4.0: No such file or directory error: Setup script exited with error: command 'gcc-4.0' failed with exit status 1

home brew Error: Failed executing: python setup.py build_ext

I am not really sure where to go from here.

Thanks, CG

Cory Gwin
  • 1,243
  • 1
  • 17
  • 27

5 Answers5

8

Xcode 4.1 on OS X Lion 10.7 no longer includes gcc-4.0 as it did in earlier versions of OS X. When you install a Python package like PIL that includes a C extension module, Python's Distutils will attempt to use the same version of the C compiler that that Python itself was build with. It sounds like the version of Python that was used to create your virtualenv is an older 32-bit-only Python built with gcc-4.0. You can tell for sure by starting the python in your virtualenv. If it says gcc-4.0, you will need to re-create the virtualenv, using a newer base Python, either one of the Apple-supplied Pythons in Lion or installing a newer python using a python.org installer or a brew recipe. Then install Distribute and pip and virtualenv for that Python, create a new virutalenv and then install PIL in it.

Ned Deily
  • 83,389
  • 16
  • 128
  • 151
  • Here is what it say in the description line of python: Python 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin – Cory Gwin Aug 02 '11 at 02:13
  • Yes, that appears to be an old Python 2.6.4 from python.org. You can see if it is installed in `/Library/Frameworks/Python.framework/Versions/2.6`. You can uninstall it by typing: `sudo rm -r /Library/Frameworks/Python.framework/Versions/2.6` That's all on one line and type carefully! – Ned Deily Aug 02 '11 at 02:31
  • Awesome, I just got everything up and running. Your are amazing! – Cory Gwin Aug 02 '11 at 02:40
  • For anyone still fighting with this one, i posted the solution that worked for me here: http://stackoverflow.com/questions/8832294/pil-installation-fails-missingstdarg-h/ – Yogev Shelly Jan 12 '12 at 11:56
  • 1
    For someone just looking to solve this problem, this answer beats around the bush a lot. I don't know how to solve the issue after reading the answer. – korona Mar 06 '12 at 14:57
  • korona: Rather than down-voting an answer that apparently has been found useful by others, perhaps you might consider asking your own question or being more explicit about what you are trying to do. – Ned Deily Mar 06 '12 at 21:51
1

After spending hours on the same problem this is what it worked for me:

Download the PIL source code and cd into it. Check which version of gcc do you have by:

gcc
i686-apple-darwin10-gcc-4.2.1: no input files

Then I force to apply this version by:

export CC=gcc-4.2

And select the correct architecture (in my case 32bit):

export ARCHFLAGS="-arch i386"

For 64 use export ARCHFLAGS="-arch x86_64"

Then build and install:

python setup.py build
python setup.py install
0

If it helps any, I solved this pesky issue with sym links, and I think it will work for you. I wrote this with my version of gcc in mind, which is 4.2:

cd /usr/bin
rm cc gcc c++ g++
ln -s gcc-4.2 cc
ln -s gcc-4.2 gcc
ln -s c++-4.2 c++
ln -s g++-4.2 g++
ln -s gcc-4.2 gcc-4.0

There ya go!

jesuis
  • 2,246
  • 3
  • 19
  • 17
0

An Idea would be to point gcc-4.0 to the default gcc flag:

sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.0
marcelosalloum
  • 3,481
  • 4
  • 39
  • 63
0

Can you find the gcc-4.0 binary on your system? You might need to add the directory it's in to your PATH environment variable.

Carl Norum
  • 219,201
  • 40
  • 422
  • 469
  • there is one in /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.0 which seems rather random. There is not a copy in usr/bin or/developer/usr/bin which is what I would expect. How would I add that to my PATH env var? – Cory Gwin Aug 02 '11 at 01:43