简体   繁体   中英

Linking source installed pandas to homebrew'd python

I am attempting to install the python package pandas .

All my existing python gear has been installed using home-brew / easy_install / pip, however pip and easy_install both fail on pandas -- claiming that i do not have numpy > 1.6 (though when in python numpy.__version__ returns 1.6.2).

Despite this pip install numpy --upgrade reports that I am up-to-date.

To hack around this, I git-cloned the source code down, and ran python setup.py install in my /Library/Python/... directory. It seemed to build okay, however when i import pandas, i get an error and i'm not sure what to do about it.

Can anyone help me link the compiled library to my existing install?

The error follows:

dlopen(/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.9.1.dev_5a152bd-py2.7-macosx-10.7-x86_64.egg/pandas/lib.so, 2): Symbol not found: _floatify
  Referenced from: /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.9.1.dev_5a152bd-py2.7-macosx-10.7-x86_64.egg/pandas/lib.so
Expected in: flat namespace
in /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.9.1.dev_5a152bd-py2.7-macosx-10.7-x86_64.egg/pandas/lib.so
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.9.1.dev_5a152bd-py2.7-macosx-10.7-x86_64.egg/pandas/__init__.py", line 10, in <module>
import pandas.lib as lib
ImportError: dlopen(/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.9.1.dev_5a152bd-py2.7-macosx-10.7-x86_64.egg/pandas/lib.so, 2): Symbol not found: _floatify
Referenced from: /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.9.1.dev_5a152bd-py2.7-macosx-10.7-x86_64.egg/pandas/lib.so
Expected in: flat namespace
in /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.9.1.dev_5a152bd-py2.7-macosx-10.7-x86_64.egg/pandas/lib.so

This was discussed and resolved on GitHub: https://github.com/pydata/pandas/issues/2188 . The issue had to due with Clang's C99 behavior wrt inline C functions.

Fixed the root problem ( pip install pandas failing) on my MBP, and then tested it on another box -- the problem seems to be a conflict between the old version of numpy that comes with the mac install, and the newer one subsequently installed using pip . Pandas sees the old numpy, and fails.

To fix this, cd to the location of the default packages. Yours is probably the same as mine:

$ cd /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/ 
$ sudo rm -r numpy

$ sudo pip install pandas

With that out of the way, sudo pip install pandas worked for me on both boxes.

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