36
bash-3.2$ sudo easy_install appscript  
Password:  
Searching for appscript  
Reading http://pypi.python.org/simple/appscript/  
Reading http://appscript.sourceforge.net  
Best match: appscript 1.0.0  
Downloading http://pypi.python.org/packages/source/a/appscript/appscript-1.0.0.tar.gz#md5=6619b637037ea0f391f45870c13ae38a  
Processing appscript-1.0.0.tar.gz  
Running appscript-1.0.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-C4d1az/appscript-1.0.0/egg-dist-tmp-yVTHww  
/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed  
Installed assemblers are:  
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64  
/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386  

I'm a pretty big noob at this stuff (I've learned to use python and unix a bit, but I've never had to deal with installation.) Earlier I was getting an error related to gcc-4.2 not being found, and I found some posts that recommended reinstalling XCode. I went with 4.0 (bad choice?) and now I get this. I've got no idea what to do at this point.

Joe Shaw
  • 22,066
  • 16
  • 70
  • 92
Tom
  • 371
  • 5
  • 4
  • it appears you're running on a PPC Mac and you don't have the GNU assembler for it. unfortunately, I don't know how to fix that. – jcomeau_ictx Mar 10 '11 at 06:52
  • 3
    If it's 10.6.6, it's not PPC. – geekosaur Mar 10 '11 at 06:57
  • Did you try [this related answer](http://stackoverflow.com/questions/2769910/appscript-on-osx-10-6-3-python-2-6-1)? I use Appscript successfully under Macports, if that is an option for you. – samplebias Mar 10 '11 at 07:08
  • 1
    I did, which is what prompted me to update XCode. I definitely checked off the UNIX Development option. – Tom Mar 10 '11 at 07:09

4 Answers4

77

This happened for me after having upgraded to XCode 4; I haven't had time to figure out what went wrong during the upgrade (or whether this is the intended behaviour), but the following workaround works for me:

sudo env ARCHFLAGS="-arch i386" easy_install whatever

The ARCHFLAGS trick works with setup.py as well:

env ARCHFLAGS="-arch i386 -arch x86_64" python setup.py install
Tamás
  • 47,239
  • 12
  • 105
  • 124
  • 2
    This got me pointed in the right direction for a different library that was having the same issue. Apparently XCode 4 no longer supports ppc which these extensions are trying to build for. Not entirely sure if the proper fix is in Python or easy_install though. This link verifies lack of ppc support: http://lists.apple.com/archives/xcode-users/2011/Mar/msg00215.html – Paul J. Davis Mar 12 '11 at 21:32
  • damn, what the hell! this took me so long to figure out, thanks for posting this. – xitrium Mar 15 '11 at 03:06
  • 1
    This was ridiculously helpful installing matplotlib with the Apple-supplied Python and Xcode 4. I swapped out `x86_64` for `i386` in the `easy_install` command for a 64-bit Python and it worked like a charm. Thanks! – Tim Mar 19 '11 at 20:05
  • It worked for me, when I was trying to install urwid. Many thanks! – ZelluX Jun 20 '11 at 08:04
  • 1
    Works for me too! I did this: export ARCHFLAGS="-arch i386 -arch x86_64" ; pip install lxml – James Cooper Jun 22 '11 at 17:23
  • For some reason, this works perfectly when setting the ARCHFLAGS on the *same line* as calling `pip` or `easy_install`, but setting the ARCHFLAGS on a separate terminal command or in my profile is ineffective. – Cody Hess Oct 02 '11 at 20:35
  • 1
    @CodyHess: have you tried exporting ARCHFLAGS from your profile? (I.e., ``export ARCHFLAGS="-arch i386 -arch x86_64"``?) – Tamás Oct 02 '11 at 22:12
15

I found another solution here which solves the problem once and for all. It turns out XCode4 still has the ppc assembler. You just need a symlink to it in the right place:

$ sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/usr/libexec/gcc/darwin/ppc /Developer/usr/libexec/gcc/darwin
$ sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/usr/libexec/gcc/darwin/ppc /usr/libexec/gcc/darwin

Fixed the problem for me with XCode4 installed on Snow Leopard.

EDIT: I tried other solutions, which worked in some cases, but invariably encountered a package that hardcoded the PPC requirement somewhere. Providing the PPC assembler got rid of all these problems once and for all.

Aneil Mallavarapu
  • 3,485
  • 5
  • 37
  • 41
  • 1
    Yay, this is great, thanks. However, note that this probably works only for those who have the iOS SDK installed. (Cannot check it, I do have the iOS SDK and it works for me, but I guess that there is no iPhoneOS.platform folder in the default XCode 4 distribution). – Tamás Jun 22 '11 at 18:49
1

For me, the key was the ppc assembler, not the ARCHFLAGS stuff. But, the suggestion above didn't work; I didn't have the files in those locations. But with some tinkering and poking around, I found that I did have the ppc assember at /usr/bin/as. I first tried sudo ln -s /usr/bin/as /usr/libexec/as/ppc/as, but that failed (something about could not fork process...??). So I ended up just doing sudo cp /usr/bin/as /usr/libexec/as/ppc/as, and that worked (I think I had to do some sudo mkdirs along that path, as well).

djangodude
  • 5,362
  • 3
  • 27
  • 39
0

Using the system Pythons on Mac OS X 10.6, you'll need to have the gcc-4.2 from the Apple Xcode Developer Tools installed to build extension modules, like with Appscript. Other products may need the Xcode gcc-4.0 so you should install them both. They co-exist just fine.

Ned Deily
  • 83,389
  • 16
  • 128
  • 151
  • Where can one get a hold of gcc-4.0? I keep running into problems as I'm trying to install various modules for Python 2.7 under OS X 10.6. Continuous complaints about the lack of gcc-4.0. – Chris Apr 09 '11 at 18:10
  • gcc-4.0 is included with the default Xcode 3.x Developer Tools for OS X 10.6 (but may not be included with the new optional Xcode 4). I believe 3.2.6 is the most recent. From the Xcode 3.x installer, you may also need to select the "Mac OS X 10.4 SDK" subpackage which is not selected by default. – Ned Deily Apr 09 '11 at 19:57