Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issues installing pandas: "command 'llvm-gcc-4.2' failed with exit status 1"

I want to install pandas on MAC OS X 10.7 with Python 2.7 with "sudo pip install pandas". Some of the output I'm getting:

Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pandas/index.c -o build/temp.macosx-10.7-intel-2.7/pandas/index.o
    In file included from pandas/index.c:317:
    pandas/src/numpy_helper.h: In function ‘infer_type’:
    pandas/src/numpy_helper.h:32: error: ‘PyDatetimeArrType_Type’ undeclared (first use in this function)
    pandas/src/numpy_helper.h:32: error: (Each undeclared identifier is reported only once
    pandas/src/numpy_helper.h:32: error: for each function it appears in.)
    pandas/src/numpy_helper.h: In function ‘get_datetime64_value’:
    pandas/src/numpy_helper.h:53: error: ‘PyDatetimeScalarObject’ undeclared (first use in this function)
    pandas/src/numpy_helper.h:53: error: expected expression before ‘)’ token
    pandas/src/numpy_helper.h: In function ‘is_datetime64_object’:
    pandas/src/numpy_helper.h:84: error: ‘PyDatetimeArrType_Type’ undeclared (first use in this function)
    pandas/src/numpy_helper.h: In function ‘is_timedelta64_object’:
    pandas/src/numpy_helper.h:89: error: ‘PyTimedeltaArrType_Type’ undeclared (first use in this function) 

And I get this:

lipo: can't open input file: /var/tmp//ccaW8SVp.out (No such file or directory)

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

All the dependencies (NumPy, pythondateutil, pytz) are working fine. I've also the latest version of the Command Line Tools as suggested here: Why am I getting the error: command 'llvm-gcc-4.2' failed with exit status 1 and here gcc-4.2 failed with exit status 1

I think my question is strongly related to this (not helping) post: Issues with installing pandas in python in MAC

And now I'm out of options and have really no idea what to do :-( Except asking for help... So thanks in advance!

like image 586
los_floppos Avatar asked Mar 21 '23 07:03

los_floppos


2 Answers

For me, the following fixed it:

sudo rm -rf /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/
sudo pip install --upgrade numpy
sudo pip install pandas

I noticed that Pandas was trying to link against an older version of numpy under Frameworks, rather than the newer one under /Library/Python/2.7/site-packages

like image 169
Boris M Avatar answered Mar 23 '23 21:03

Boris M


It takes a little while to set up, but I've found MacPorts to be extremely useful in installing third-party modules. In my experience it has many more packages available than Homebrew, and the dependencies are installed with a lot less fuss and bother than trying to do it yourself. Check out the Quick Start for how to install.

Once it's installed, restart your Terminal session, and check your PATH (echo $PATH) to ensure that /opt/local/bin is before /usr/bin and /Library/Frameworks/Python.framework/Versions/2.7/bin. Then, you can run sudo port install py27-pandas to get Python and all of the dependencies installed.

The drawback of installing MacPorts is that any packages you've installed using the python.org version of Python won't be available. The easiest way around this is to reinstall them using MacPorts, or if they're not available as a port, using the MacPorts version of pip.

Good luck!

like image 43
MattDMo Avatar answered Mar 23 '23 21:03

MattDMo