Reputation: 1
I installed pandas module. It required the latest version of numpy, and I had the old one pip installed the pandas module which also installs all its dependencies including numpy. When I try to import pandas module in my code, I get the error below:
/Library/Python/2.6/site-packages/pytz/__init__.py:35:
UserWarning: Module dateutil was already imported from /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/dateutil/__init__.pyc, but /Library/Python/2.6/site-packages is being added to sys.path
from pkg_resources import resource_stream
Traceback (most recent call last):
File "Python-3.py", line 10, in <module>
from pandas.io.data import DataReader
File "/Library/Python/2.6/site-packages/pandas/__init__.py", line 25, in <module>
import pandas.core.config_init
File "/Library/Python/2.6/site-packages/pandas/core/config_init.py", line 4, in <module>
from pandas.core.format import detect_console_encoding
File "/Library/Python/2.6/site-packages/pandas/core/format.py", line 25, in <module>
from pandas.tseries.period import PeriodIndex
File "/Library/Python/2.6/site-packages/pandas/tseries/period.py", line 7, in <module>
import pandas.tseries.offsets as offsets
File "/Library/Python/2.6/site-packages/pandas/tseries/offsets.py", line 3, in <module>
from pandas.tseries.tools import to_datetime
File "/Library/Python/2.6/site-packages/pandas/tseries/tools.py", line 19, in <module>
dateutil.__version__ == '2.0'): # pragma: no cover
AttributeError: 'module' object has no attribute '__version__'
I'm not able to figure out why am I getting this error and how to correct it.
Can anyone please help me with this?
Thanks!
Upvotes: 0
Views: 4050
Reputation: 105
i came across the same problem, when trying to import QTSK package, and the exact same message was displayed.
i found that the message is not displayed, when:
site.path when i was running python in /Library/Python/2.7/site-packages:
print("\n".join(sys.path))
/Library/Python/2.7/site-packages/distribute-0.6.32-py2.7.egg
/Library/Python/2.7/site-packages/cx_Oracle-5.1.2-py2.7-macosx-10.8-intel.egg
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC
/Library/Python/2.7/site-packages/PIL
/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg-info
site.path when i was running outside /Library/Python/2.7/site-packages
print("\n".join(sys.path))
/Library/Python/2.7/site-packages/distribute-0.6.32-py2.7.egg
/Library/Python/2.7/site-packages/cx_Oracle-5.1.2-py2.7-macosx-10.8-intel.egg
/Library/Python/2.7/site-packages
/Users/ssgam/QSTK
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC
/Library/Python/2.7/site-packages/PIL
/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg-info
note that the first line is empty, and is not /Library/Python/2.7/site-packages.
looks like a problem with the order of loading/lookup for packages.
after setting
PYTHONPATH=/Library/Python/2.7/site-packages/distribute-0.6.32-py2.7.egg
export PYTHONPATH
the problem is gone.
hth with your problem as well ... sam
Upvotes: 1