When I try to import pandas into Python I get this error:
>>> import pandas
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/robertdefilippi/miniconda2/lib/python2.7/site-packages/pandas/__init__.py", line 44, in <module>
from pandas.core.api import *
File "/Users/robertdefilippi/miniconda2/lib/python2.7/site-packages/pandas/core/api.py", line 9, in <module>
from pandas.core.groupby import Grouper
File "/Users/robertdefilippi/miniconda2/lib/python2.7/site-packages/pandas/core/groupby.py", line 17, in <module>
from pandas.core.frame import DataFrame
File "/Users/robertdefilippi/miniconda2/lib/python2.7/site-packages/pandas/core/frame.py", line 41, in <module>
from pandas.core.series import Series
File "/Users/robertdefilippi/miniconda2/lib/python2.7/site-packages/pandas/core/series.py", line 2909, in <module>
import pandas.tools.plotting as _gfx
File "/Users/robertdefilippi/miniconda2/lib/python2.7/site-packages/pandas/tools/plotting.py", line 135, in <module>
if _mpl_ge_1_5_0():
File "/Users/robertdefilippi/miniconda2/lib/python2.7/site-packages/pandas/tools/plotting.py", line 130, in _mpl_ge_1_5_0
return (matplotlib.__version__ >= LooseVersion('1.5')
AttributeError: 'module' object has no attribute '__version__'
But when I check if pandas is installed:
me$ conda install pandas
Fetching package metadata: ....
Solving package specifications: .....................
# All requested packages already installed.
# packages in environment at /Users/me/miniconda2:
#
pandas 0.17.1 np110py27_0
So I don't know what is wrong? What is going on with my pandas?
Edit
$ pip list |grep matplotlib
$ conda list matplotlib
# packages in environment at /Users/me/miniconda2:
#
matplotlib 1.5.0 np110py27_0
For some reason there was no output to pip list |grep matplotlib
Edit2
I wanted to see if there was a different path to the executables ipython
and python
. So I ran this:
$ python
>>> import sys
>>> print sys.executable
/Users/me/miniconda2/bin/python
However in IPython, I get this:
$ ipython notebook
>>> import sys
>>> print sys.executable
/usr/local/opt/python/bin/python2.7
Could that be the problem?
Remove (or rename) the file matplotlib.py
from your current working directory. It shadows the real library with the same name.
It worked for me
pip install pyparsing==2.4.7
Remove (or rename) the file matplotlib.py
from your current working directory. It shadows the real library with the same name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With