Aws-cli: aws cli fails on import 'is_json_value_header'

Created on 4 Apr 2017  路  12Comments  路  Source: aws/aws-cli

/usr/local/bin/aws --region eu-west-1 s3 cp
Traceback (most recent call last):
  File "/usr/local/bin/aws", line 19, in <module>
    import awscli.clidriver
  File "/usr/local/lib/python3.4/dist-packages/awscli/clidriver.py", line 33, in <module>
    from awscli.help import ProviderHelpCommand
  File "/usr/local/lib/python3.4/dist-packages/awscli/help.py", line 27, in <module>
    from awscli.clidocs import ProviderDocumentEventHandler
  File "/usr/local/lib/python3.4/dist-packages/awscli/clidocs.py", line 18, in <module>
    from botocore.utils import is_json_value_header
ImportError: cannot import name 'is_json_value_header'
root@ip-172-31-42-161:/wekapp# pip3 freeze

appdirs==1.4.3
awscli==1.11.71
boto3==1.3.1
botocore==1.4.93
certifi==2017.1.23
cmigemo==0.1.6
colorama==0.3.7
contextlib2==0.5.4
decorator==4.0.11
docutils==0.13.1
ecdsa==0.13
elasticsearch==1.9.0
gevent==1.2.1
greenlet==0.4.12
influxdb==2.11.0
ipython==5.1.0
ipython-genutils==0.2.0
Jinja2==2.8
jira==1.0.7.dev20161112134044
jmespath==0.9.2
MarkupSafe==1.0
mock==1.3.0
oauthlib==2.0.2
ordereddict==1.1
packaging==16.8
paramiko==1.16.0
pbr==2.0.0
percol==0.2.1
pexpect==4.2.1
pickleshare==0.7.4
prompt-toolkit==1.0.14
ptyprocess==0.5.1
pudb==2017.1.1
py==1.4.33
pyasn1==0.2.3
pycrypto==2.6.1
Pygments==2.2.0
pyparsing==2.2.0
pytest==2.7.1
python-dateutil==2.4.2
pytz==2017.2
pyvmomi==6.0.0
PyYAML==3.12
rauth==0.7.2
raven==5.11.1
redis==2.10.5
requests==2.10.0
requests-oauthlib==0.8.0
requests-toolbelt==0.7.1
rsa==3.4.2
s3transfer==0.1.10
simplegeneric==0.8.1
six==1.10.0
slacker==0.7.9
termcolor==1.1.0
traitlets==4.1.0
urllib3==1.12
URLObject==2.4.0
urwid==1.2.1
wcwidth==0.1.7
closing-soon guidance

Most helpful comment

Upgrade botocore with pip install -U botocore

All 12 comments

Upgrade botocore with pip install -U botocore

Why isn't that enforced in the awscli dependency configuration?

It is enforced here. pip install -U awscli would have fixed it as well. I was explicitly calling out what the incorrect package was.

The CLI and botocore are released in lock step and each version of the CLI depends on an exact version of botocore. This can still get broken if a different version of botocore is installed over the correct one after the cli has been installed, or the cli is upgraded with --no-deps which does not upgrade dependencies.

I had a same problem.
I installed botocore 1.5.37, and re-install botocore 1.5.38.
It's working.

Is it botocore problem?

I also had this problem, and running an awscli upgrade with pip as suggested above fixed my issue.

I am running into this issue with last version of aws-cli and botocore:

awscli==1.11.82
botocore==1.5.45

Command

aws --region us-east-1 ecs register-task-definition --cli-input-json file://./task-definition.json

Error

Traceback (most recent call last):
  File "/usr/local/bin/aws", line 19, in <module>
    import awscli.clidriver
  File "/usr/local/lib/python2.7/site-packages/awscli/clidriver.py", line 35, in <module>
    from awscli.help import ProviderHelpCommand\n  File "/usr/local/lib/python2.7/site-packages/awscli/help.py", line 27, in <module>
    from awscli.clidocs import ProviderDocumentEventHandler
  File "/usr/local/lib/python2.7/site-packages/awscli/clidocs.py", line 18, in <module>
    from botocore.utils import is_json_value_header
ImportError: cannot import name is_json_value_header

I ran into same issue:

aws-cli-1.11.83-1.46.amzn1.noarch
botocore-1.5.46-1.63.amzn1.noarch

aws --version
Traceback (most recent call last): File "/usr/bin/aws", line 19, in <module> import awscli.clidriver File "/usr/lib/python2.7/dist-packages/awscli/clidriver.py", line 35, in <module> from awscli.help import ProviderHelpCommand File "/usr/lib/python2.7/dist-packages/awscli/help.py", line 27, in <module> from awscli.clidocs import ProviderDocumentEventHandler File "/usr/lib/python2.7/dist-packages/awscli/clidocs.py", line 18, in <module> from botocore.utils import is_json_value_header ImportError: cannot import name is_json_value_header

To anyone still reporting this issue, fully purge your aws-cli using both sudo and normal user. I at one point installed it with sudo and had it incorrectly linked to old binaries with the newly installed awscli. I was seeing the same errors reported here. Once I fully cleaned out all remnants of awscli and followed the normal aws install instructions (not using sudo), everything worked fine.

Also happening with:
pip list | grep "boto\|awscli"
awscli (1.11.63)
boto (2.43.0)
boto3 (1.4.0)
botocore (1.5.26)

Closing this as it is not an issue with the CLI and the answers here should be sufficient for anyone searching for this issue to be able to get it fixed. Specifically @zivester's answer and mine.

With that said @madave 1.5.26 is the wrong version. Please upgrade botocore and/or awscli as detailed above.

pip install botocore==1.5.34 fixed for me.

sudo pip uninstall awscli
pip install --user awscli

fixed for me. And added $HOME/.local/bin to my PATH.

Was this page helpful?
0 / 5 - 0 ratings