1

I have successfully installed Pandas through Anaconda in PyCharm. Unfortunately when I run Import Pandas this is what I get as the output:

/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 
"/Users/PycharmProjects/Security upload/Security 
upload.py"
Traceback (most recent call last):
File "/Users/PycharmProjects/Security upload/Security 
upload.py", line 3, in <module>
import pandas
File "/Users/Library/Python/2.7/lib/python/site-
packages/pandas/__init__.py", line 23, in <module>
from pandas.compat.numpy import *
File "/Users/Library/Python/2.7/lib/python/site-
packages/pandas/compat/__init__.py", line 361, in <module>
from dateutil import parser as _date_parser
File "/Users/Library/Python/2.7/lib/python/site-
packages/dateutil/parser.py", line 43, in <module>
from . import tz
File "/Users/Library/Python/2.7/lib/python/site-
packages/dateutil/tz/__init__.py", line 1, in <module>
from .tz import *
File "/Users/Library/Python/2.7/lib/python/site-
packages/dateutil/tz/tz.py", line 23, in <module>
from ._common import tzname_in_python2, _tzinfo, _total_seconds
File "/Users/Library/Python/2.7/lib/python/site-
packages/dateutil/tz/_common.py", line 2, in <module>
from six.moves import _thread
ImportError: cannot import name _thread

Could someone provide some insight on how to approach a solution?

DenSyd
  • 11
  • 1
  • 2

2 Answers2

2

According to here and here, you need to fix your dateutil package.

pip uninstall python-dateutil
pip install python-dateutil --upgrade

Maybe this:

sudo pip uninstall python-dateutil
sudo pip install python-dateutil==2.2
TheDetective
  • 642
  • 1
  • 6
  • 17
  • Thank for swift reply. I have already tried this, unfortunately I still have the sane issue. – DenSyd Aug 02 '17 at 19:31
  • You might need a specific version of dateutil. See my edit. – TheDetective Aug 02 '17 at 19:33
  • Thank, this I also tried didn't workout neither. I found workaround in Preferences of PyCharm within Project Interpreter selected anaconda/bin/python,instead of Python 2.7, the same for interpreter. Now it seems to work. – DenSyd Aug 02 '17 at 19:53
  • In any case could you explain why dateutil could help? – DenSyd Aug 02 '17 at 19:54
  • Okay, glad you were able to get it to work. I'm not entirely sure why it's needed though. – TheDetective Aug 02 '17 at 19:54
0

Was facing the same issue and started installing jupyter and got few errors

reinstalling ipython worked for me

sudo -H pip install --ignore-installed -U ipython

I also needed to reinstall pyzmq

sudo -H pip install --ignore-installed -U pyzmq

after this I re-ran import pandas in ipython and it worked