Aws-cli: More SyntaxWarning issues with Python 3.8

Created on 10 Jan 2020  路  24Comments  路  Source: aws/aws-cli

I'm seeing SyntaxWarning issues with the latest awscli and Python 3.8 versions.

john:~$ aws --version
aws-cli/1.16.310 Python/3.8.1 Darwin/18.7.0 botocore/1.13.46

Symptoms:

john:~$ aws s3 sync src/ s3://my-backup/src/
/usr/local/Cellar/awscli/1.16.310_1/libexec/lib/python3.8/site-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if x is 0 or x is 1:
/usr/local/Cellar/awscli/1.16.310_1/libexec/lib/python3.8/site-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if x is 0 or x is 1:
/usr/local/Cellar/awscli/1.16.310_1/libexec/lib/python3.8/site-packages/jmespath/visitor.py:34: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif y is 0 or y is 1:
/usr/local/Cellar/awscli/1.16.310_1/libexec/lib/python3.8/site-packages/jmespath/visitor.py:34: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif y is 0 or y is 1:
/usr/local/Cellar/awscli/1.16.310_1/libexec/lib/python3.8/site-packages/jmespath/visitor.py:260: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if original_result is 0:
third-party

Most helpful comment

Had the same issue, upgraded outdated python modules and voila the SyntaxWarning message went away.

Here is the command to update:

pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1  | xargs -n1 pip3 install -U

All 24 comments

I am seeing the same thing on a new clean machine.
aws-cli/1.17.0 Python/3.8.1 Darwin/19.2.0 botocore/1.14.0

This issue in the jmespath library appears to be tracking the problems with that library that causes those messages
https://github.com/jmespath/jmespath.py/issues/187

This should be fixed in 1.17.7 and 1.17.8. I tested both versions and could not see any more SyntaxWarning messages.

I'm using

aws-cli/1.17.8 
Python/3.8.1 
Darwin/19.2.0 
botocore/1.14.8

and yet the warnings still show up.

Also, my aws-cli is installed via Homebrew (i.e. brew install awscli). Not sure if installing via pip is better.

On what commands do you see the warnings?

I have these warnings too:

$ aws --version
/usr/local/Cellar/awscli/1.17.8/libexec/lib/python3.8/site-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if x is 0 or x is 1:
/usr/local/Cellar/awscli/1.17.8/libexec/lib/python3.8/site-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if x is 0 or x is 1:
/usr/local/Cellar/awscli/1.17.8/libexec/lib/python3.8/site-packages/jmespath/visitor.py:34: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif y is 0 or y is 1:
/usr/local/Cellar/awscli/1.17.8/libexec/lib/python3.8/site-packages/jmespath/visitor.py:34: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif y is 0 or y is 1:
/usr/local/Cellar/awscli/1.17.8/libexec/lib/python3.8/site-packages/jmespath/visitor.py:260: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if original_result is 0:
aws-cli/1.17.8 Python/3.8.1 Darwin/19.2.0 botocore/1.14.8

Had the same issue, upgraded outdated python modules and voila the SyntaxWarning message went away.

Here is the command to update:

pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1  | xargs -n1 pip3 install -U

I installed awscli via Homebrew but there's no update available yet that fixes these warnings.

i have same issue.

tayfun@tayfun-tayfun:~$ aws --version
aws-cli/1.17.8 Python/3.8.1 Linux/5.3.0-26-generic botocore/1.14.8

Uninstalling awscli from brew and installing it via pip3, which I do concede is not ideal since it's system-wide Python, cleaned up these warnings for me.

brew uninstall awscli
sudo pip3 install awscli
$ aws --version
aws-cli/1.17.9 Python/3.7.6 Darwin/19.2.0 botocore/1.14.9

Well, it seems I went from one error to the next. Initially started with this error so I upgraded Python which forced an update of awscli, and here I am.

dyld: Library not loaded: @executable_path/../.Python
  Referenced from: /usr/local/Cellar/awscli/1.14.30/libexec/bin/python3.6

@saidsef 's command above worked for me! No more errors with brew awscli.

Had the same issue, upgraded outdated python modules and voila the SyntaxWarning message went away.

Here is the command to update:

pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1  | xargs -n1 pip3 install -U

Thanks saidsef, works like a charm, annoying warning messages are gone!

Please be careful allowing pip to mass-upgrade modules -- you could conflict with python packages installed by your system's package manager, resulting in issues when performing a full system upgrade.

It is advised that you instead uninstall awscli, and pip install it.

Built awscli formula locally with 1.17.9 artifact. Python syntax warnings stopped.

Workaround is cloning homebrew-core.git locally, tick the archive/package version in Formula/awscli.rb to .9 , then:

brew upgrade --build-from-source ./Formula/awscli.rb

Your brew managed awscli should now be at 1.17.9

Check if you don't have two version of awscli installed (brew and pip)

Had similar warnings and could not figure out why, as i had everything updated...
Found out it was related to having two install's of awscli. Long long time ago i had installed awscli with pip (awscli-1.16.130), and later moved to brew version (after updating today it's awscli: stable 2.0.0) but didn't unistall the old version.
Path pointed (as far i could find out) to the correct brew version, but for some reason the old installed 'pip3' version was generating havoc...

to check:
brew info awscli
pip3 list installed |grep awscli

after i removed the pip version, my brew installed awscli stopped complaining about 'if x is 0 or x is 1:' ...

pip3 uninstall awscli

I was experiencing a similar issue, pip uninstall jmespath resolved the issue. I had jmespath installed via brew.

% aws s3 ls /usr/local/Cellar/awscli/2.0.0/libexec/lib/python3.8/site-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="? if x is 0 or x is 1: /usr/local/Cellar/awscli/2.0.0/libexec/lib/python3.8/site-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="? if x is 0 or x is 1: /usr/local/Cellar/awscli/2.0.0/libexec/lib/python3.8/site-packages/jmespath/visitor.py:34: SyntaxWarning: "is" with a literal. Did you mean "=="? elif y is 0 or y is 1: /usr/local/Cellar/awscli/2.0.0/libexec/lib/python3.8/site-packages/jmespath/visitor.py:34: SyntaxWarning: "is" with a literal. Did you mean "=="? elif y is 0 or y is 1: /usr/local/Cellar/awscli/2.0.0/libexec/lib/python3.8/site-packages/jmespath/visitor.py:260: SyntaxWarning: "is" with a literal. Did you mean "=="? if original_result is 0:

Error on a brand new Macbook, fresh mac OS, all updated installed. Installed with brew.

/usr/local/Cellar/awscli/2.0.0/libexec/lib/python3.8/site-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if x is 0 or x is 1:
/usr/local/Cellar/awscli/2.0.0/libexec/lib/python3.8/site-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if x is 0 or x is 1:
/usr/local/Cellar/awscli/2.0.0/libexec/lib/python3.8/site-packages/jmespath/visitor.py:34: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif y is 0 or y is 1:
/usr/local/Cellar/awscli/2.0.0/libexec/lib/python3.8/site-packages/jmespath/visitor.py:34: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif y is 0 or y is 1:
/usr/local/Cellar/awscli/2.0.0/libexec/lib/python3.8/site-packages/jmespath/visitor.py:260: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if original_result is 0:

Error on a brand new Macbook, fresh mac OS, all updated installed. Installed with brew.

The same issue and resolved by pip install --upgrade jmespath

I was experiencing a similar issue, pip uninstall jmespath resolved the issue. I had jmespath installed via brew.

I made a little bit different, I my _jmespath_ was installed by PIP using python 2.7...
So I uninstall and re-install using pip3 and solved.

I've got the same issue which I resolved with:
pip uninstall jmespath; pip3 install jmespath

8 months later and the issue still exists with homebrew. I absolutely do not want to install pip and deal with python version issues directly on Mac OS. Homebrew has been the defacto package manager for Mac OS for well over a decade now.

Hi @john-aws et al, the Homebrew formula for the AWS CLI is not managed by AWS, but by the Homebrew maintainers. I do not experience the SyntaxWarnings on Python 3.8 using one of the supported installation mechanisms. You would need to open an issue with the Homebrew team.

@kdaily how about Amazon step up and deal with it.. work with them... or you know... maintain it... This PIP garbage is ridiculous.

Was this page helpful?
0 / 5 - 0 ratings