Reputation: 51
I was playing with Python's pandas package before getting the O'Reilly book. When I tried to install pandas after installing xcode and EPDFree successfully the pandas installation using easy_install presented many warnings, and when I tested to see if pandas was working it is clear it is not. I have tried to remove and re-install pandas and Numpy several times with no success. I am new to this so am surely doing something wrong.
This is what I get when I run Python and try to import pandas and Numpy:
$ python
Python 2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
>>> import pandas
No module named numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/pandas-0.12.0-py2.7-macosx-10.8-intel.egg/pandas/__init__.py", line 6, in <module>
from . import hashtable, tslib, lib
File "numpy.pxd", line 157, in init pandas.hashtable (pandas/hashtable.c:19547)
ImportError: No module named numpy
Is there a way I can either fix this or start over with the entire installation?
Here is some more information when I try to install pandas and Numpy:
$ sudo easy_install pandas
Password:
Searching for pandas
Best match: pandas 0.12.0
Processing pandas-0.12.0-py2.7-macosx-10.8-intel.egg
pandas 0.12.0 is already the active version in easy-install.pth
Using /Library/Python/2.7/site-packages/pandas-0.12.0-py2.7-macosx-10.8-intel.egg
Processing dependencies for pandas
Finished processing dependencies for pandas
$ sudo easy_install numpy
Searching for numpy
Best match: numpy 1.6.1
numpy 1.6.1 is already the active version in easy-install.pth
Using /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Processing dependencies for numpy
Finished processing dependencies for numpy
Upvotes: 2
Views: 2913
Reputation: 143
Be careful that the right python version is launched. If you're using brew version: which python
should return /usr/local/bin.
If it's not the case, check your $PATH environment variable in .bash_profile.
That worked for me. I guess it's similar using easy_install than brew and pip.
Upvotes: 0
Reputation: 1834
Start over the cleaner way. I'd recommend looking into tools like pyenv and virtualenv if you are going to do any amount of work with Python and especially when it comes to installing additional packages. Pyenv lets you easily manage and switch between multiple versions (including micro versions x.x.3, x.x.5, etc). Virtualenv lets you create isolated Python environments where you can pin down versions of site-packages specific to a particular project.
It will go something like:
Just using virtualenv:
$ pip install virtualenv
$ virtualenv foo
$ source foo/bin/activate
$ pip install pandas
$ pip install numpy
Or, using pyenv + virtualenv (for additional control over Python versions, e.g. specify 2.7.2), first install pyenv, then:
$ pip install virtualenv
$ pyenv install 2.7.2
$ pyenv shell 2.7.2
$ virtualenv `which python` foo
$ source foo/bin/activate
$ pip install pandas
$ pip install numpy
Upvotes: 2