简体   繁体   中英

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!

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

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!

Update: I finally managed to get it installed (with the help of others I should add...!). I am not sure if I remember everything I did correctly and extensively, but here are some pointers:

I think the point is that the numpy version you have should be => 1.6 in order for pandas to be able to install properly. However the default Python installation provided by Apple only allows for numpy up to version 1.5.1. It might be, BTW, that there is more or other reasons why pandas doesn't like the Mac OS X provided Python, but the point remains that you need another Python version.

So, I downloaded and installed a Python 2.7.6 version from Python.org.

Then you can "pip install --upgrade numpy" and it will be numpy 1.8.

NOTE If '$ which python' gives you the new Python.org Python 2.7.6 version, you might want to say '$ python pip install ...' as the first line of pip contains the default '/usr/bin/python' so that will install whatever it is your're installing for the "old" default Python version.

NOTE that you should also upgrade/reinstall scipy, if you use it, so the numpy and scipy version correspond to one another.

I hope this is of any avail to anyone...!

It's very strange.

It seems the default python 2.7 with OSX can not install pandas well.

I just install python 3.3 and then it works.

pythonbrew switch Python-3.3.1

pip install pandas

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM