awslabs / aws-shell

An integrated shell for working with the AWS CLI.
Apache License 2.0
7.15k stars 770 forks source link

ImportError: cannot import name _thread #161

Open hakanson opened 7 years ago

hakanson commented 7 years ago

I just installed aws-shell on Mac OS X Yosemite (10.10.5) and got the following error on first execution:

$ aws-shell
Traceback (most recent call last):
  File "/usr/local/bin/aws-shell", line 9, in <module>
    load_entry_point('aws-shell==0.1.1', 'console_scripts', 'aws-shell')()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 357, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2394, in load_entry_point
    return ep.load()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2108, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/Library/Python/2.7/site-packages/awsshell/__init__.py", line 7, in <module>
    from awsshell import shellcomplete
  File "/Library/Python/2.7/site-packages/awsshell/shellcomplete.py", line 15, in <module>
    import botocore.session
  File "/Library/Python/2.7/site-packages/botocore/session.py", line 26, in <module>
    import botocore.credentials
  File "/Library/Python/2.7/site-packages/botocore/credentials.py", line 22, in <module>
    from dateutil.parser import parse
  File "/Library/Python/2.7/site-packages/dateutil/parser.py", line 43, in <module>
    from . import tz
  File "/Library/Python/2.7/site-packages/dateutil/tz/__init__.py", line 1, in <module>
    from .tz import *
  File "/Library/Python/2.7/site-packages/dateutil/tz/tz.py", line 23, in <module>
    from ._common import tzname_in_python2, _tzinfo, _total_seconds
  File "/Library/Python/2.7/site-packages/dateutil/tz/_common.py", line 2, in <module>
    from six.moves import _thread
ImportError: cannot import name _thread

I solved by following the advice of Matplotlib issue on OS X (“ImportError: cannot import name _thread”) and changing the versions of python-dateutil.

sudo pip uninstall python-dateutil
sudo pip install python-dateutil==2.2

I'm not well versed in Python, but this looks related to the version of six and I wanted to post this issue to see if that was the right fix and it should be added to the README, or if it is something that should be fixed.

donnemartin commented 7 years ago

Hi @hakanson, thanks for the detailed report.

I think your fix is correct. We have a similar fix for El-Capitan users discussed in the README, perhaps that section could be expanded.

mintisan commented 7 years ago

Thanks for your sharing. It works for me On macOS EI Caption Version 10.11.6

dblock commented 5 years ago

This worked for me. But seriously ...