3

I am attempting to install rpy2 using pip with:

    $ sudo pip install rpy2

which exits with an error:

    gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -DR_INTERFACE_PTRS=1 -DHAVE_POSIX_SIGJMP=1 -DCSTACK_DEFNS=1 -DRIF_HAS_RSIGHAND=1 -I./rpy/rinterface -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/opt/local/lib/R/include/x86_64 -I/opt/local/lib/R/include -c ./rpy/rinterface/_rinterface.c -o build/temp.macosx-10.3-fat-2.7/./rpy/rinterface/_rinterface.o

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

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

I have attempted to also install rpy2 with macports, however the install completed but rpy2 would not import. I have install XCode, Version 4.0.2 Build 4A2002a, and gcc is installed.

    $ which gcc

returns:

    /usr/bin/gcc

and

    $ gcc

returns:

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

It seems that it is looking for an older version of gcc and I have no idea how to point it in the right place. Any help would be greatly appreciated.

user865819
  • 31
  • 2

4 Answers4

1

It seems to think that you're using OSX 10.3: build/temp.macosx-10.3, which might be the reason why it's trying to look for an old gcc compiler.

You should be able to overwrite the compiler with the CC environment:

export CC=gcc 
pip install rpy2

I think it's a typical distutils issue.

Community
  • 1
  • 1
SiggyF
  • 22,088
  • 8
  • 43
  • 57
  • Thank's for the help. I followed your link and landed [here](http://stackoverflow.com/questions/5967065/python-distutils-not-using-correct-version-of-gcc/5968410#5968410). However, I couldn't get this to work. In a python environment, I get: >>> from distutils import sysconfig >>> sysconfig.get_config_var('LDSHARED') 'gcc-4.0 -bundle -undefined dynamic_lookup -arch ppc -arch i386 -g' >>> sysconfig.get_config_var('CC') 'gcc-4.0' (Sorry, formatting seems not to work), but I seem unable to change the 'CC' variable – user865819 Jul 27 '11 at 21:24
0

If it helps any, I solved this 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 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

::HACK WARNING::

This may cause something else to break in the future, but if you don't think the version of gcc that compiles your rpy2 makes a difference, you could create a symlink named /usr/bin/gcc-4.0 pointing to /usr/bin/gcc and then try the pip install again

Johnny Brown
  • 1,000
  • 11
  • 18