awslabs / awslabs/aws-shell

ImportError: cannot import name _thread

Open
#161 3 comments 20 reactions 0 assignees View on GitHub
documentation
Dominant language
Python
Stars
7.3k
Forks
780
PR merge metrics
No merged PRs in 30d

Description

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
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
from awsshell import shellcomplete
File "/Library/Python/2.7/site-packages/awsshell/shellcomplete.py", line 15, in
import botocore.session
File "/Library/Python/2.7/site-packages/botocore/session.py", line 26, in
import botocore.credentials
File "/Library/Python/2.7/site-packages/botocore/credentials.py", line 22, in
from dateutil.parser import parse
File "/Library/Python/2.7/site-packages/dateutil/parser.py", line 43, in
from . import tz
File "/Library/Python/2.7/site-packages/dateutil/tz/__init__.py", line 1, in
from .tz import *
File "/Library/Python/2.7/site-packages/dateutil/tz/tz.py", line 23, in
from ._common import tzname_in_python2, _tzinfo, _total_seconds
File "/Library/Python/2.7/site-packages/dateutil/tz/_common.py", line 2, in
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”)](http://stackoverflow.com/questions/27630114/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.

Contributor guide

Open the contributing guide

Research direction

Start at the /usr/local/bin/aws-shell entry point and trace the imports through awsshell/__init__.py and awsshell/shellcomplete.py, reproducing the Python 2.7 failure on the reported macOS setup. Determine whether the python-dateutil and six versions are the cause; done means confirming a supported dependency fix or documenting the required version in the README.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.