Aws-cli: Aws-cli run error in linux

Created on 31 May 2014  Â·  26Comments  Â·  Source: aws/aws-cli

I am using Arch linux, installed the aws from tarball tried also the pip install same problem. Using python version 3.4.

➜  awscli-1.3.13  aws
Traceback (most recent call last):
  File "/usr/bin/aws", line 5, in <module>
    pkg_resources.run_script('awscli==1.3.13', 'aws')
  File "/usr/lib/python3.4/site-packages/pkg_resources.py", line 534, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3.4/site-packages/pkg_resources.py", line 1434, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/lib/python3.4/site-packages/pkg_resources.py", line 55, in execfile
    exec(compile(open(fn).read(), fn, 'exec'), globs, locs)
  File "/usr/lib/python3.4/site-packages/awscli-1.3.13-py3.4.egg/EGG-INFO/scripts/aws", line 23, in <module>
    sys.exit(main())
  File "/usr/lib/python3.4/site-packages/awscli-1.3.13-py3.4.egg/EGG-INFO/scripts/aws", line 19, in main
    return awscli.clidriver.main()
  File "/usr/lib/python3.4/site-packages/awscli-1.3.13-py3.4.egg/awscli/clidriver.py", line 45, in main
    driver = create_clidriver()
  File "/usr/lib/python3.4/site-packages/awscli-1.3.13-py3.4.egg/awscli/clidriver.py", line 54, in create_clidriver
    event_hooks=emitter)
  File "/usr/lib/python3.4/site-packages/awscli-1.3.13-py3.4.egg/awscli/plugin.py", line 49, in load_plugins
    plugin.awscli_initialize(event_hooks)
  File "/usr/lib/python3.4/site-packages/awscli-1.3.13-py3.4.egg/awscli/handlers.py", line 78, in awscli_initialize
    register_removals(event_handlers)
  File "/usr/lib/python3.4/site-packages/awscli-1.3.13-py3.4.egg/awscli/customizations/removals.py", line 32, in register_removals
    'verify-email-address'])
  File "/usr/lib/python3.4/site-packages/awscli-1.3.13-py3.4.egg/awscli/customizations/removals.py", line 45, in remove
    self._create_remover(remove_commands))
  File "/usr/lib/python3.4/site-packages/botocore/hooks.py", line 56, in register
    self._verify_accept_kwargs(handler)
  File "/usr/lib/python3.4/site-packages/botocore/hooks.py", line 76, in _verify_accept_kwargs
    argspec = inspect.getargspec(func)
  File "/usr/lib/python3.4/inspect.py", line 930, in getargspec
    raise ValueError("Function has keyword-only arguments or annotations"
ValueError: Function has keyword-only arguments or annotations, use getfullargspec() API which can support them

Most helpful comment

For a workaround, based on what @Aeramor said I did this:

sudo apt-get remove awscli
sudo apt-get install python-pip
sudo pip install awscli

which fixed things for me :)

All 26 comments

I am running Mac OSX 10.9 and I'm getting the same error with Python 3.4, but it seems to work OK using Python 2.7.

What version of py3.4 are you using? I just tried this with py3.4.0 and I'm not getting any errors.

Ah, I see this on py3.4.1. Interesting this 3.4.1 is not backwards compatible. Looking.

Yes, exactly the python3.4.1 seems some backward compatibility issues. I suspect the problems in botocore library.

I have begun encountering this same error over the past couple of days and am unsure of how to fix it. Any ideas?

Ubuntu 14.04

Traceback (most recent call last):
  File "/usr/bin/aws", line 23, in <module>
    sys.exit(main())
  File "/usr/bin/aws", line 19, in main
    return awscli.clidriver.main()
  File "/usr/share/awscli/awscli/clidriver.py", line 44, in main
    driver = create_clidriver()
  File "/usr/share/awscli/awscli/clidriver.py", line 53, in create_clidriver
    event_hooks=emitter)
  File "/usr/share/awscli/awscli/plugin.py", line 49, in load_plugins
    plugin.awscli_initialize(event_hooks)
  File "/usr/share/awscli/awscli/handlers.py", line 73, in awscli_initialize
    register_removals(event_handlers)
  File "/usr/share/awscli/awscli/customizations/removals.py", line 32, in register_removals
    'verify-email-address'])
  File "/usr/share/awscli/awscli/customizations/removals.py", line 45, in remove
    self._create_remover(remove_commands))
  File "/usr/lib/python3/dist-packages/botocore/hooks.py", line 64, in register
    self._verify_accept_kwargs(handler)
  File "/usr/lib/python3/dist-packages/botocore/hooks.py", line 84, in _verify_accept_kwargs
    argspec = inspect.getargspec(func)
  File "/usr/lib/python3.4/inspect.py", line 936, in getargspec
    raise ValueError("Function has keyword-only arguments or annotations"
ValueError: Function has keyword-only arguments or annotations, use getfullargspec() API which can support them

I think an automated upgrade to Python caused me the same issue

Currently on Python 3.4.3

Im also having the same issue with ubuntu 14.04.

Same problem here.
Ubuntu: 14.04.3 LTS
Python: 3.4.0-0ubuntu2

Same thing started to happen today (used to work since it was an automated task).
Ubuntu: 14.04.3 LTS
python: 3.4.3-1ubuntu1~14.04.1

The previous one was 3.4.0-2ubuntu1.1 which didn't worked neither:

root@mesosm03:~# aws
Traceback (most recent call last):
  File "/usr/lib/python3.4/http/cookiejar.py", line 37, in <module>
    import threading as _threading
ImportError: No module named 'threading'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/aws", line 15, in <module>
    import awscli.clidriver
  File "/usr/share/awscli/awscli/clidriver.py", line 16, in <module>
    import botocore.session
  File "/usr/lib/python3/dist-packages/botocore/session.py", line 35, in <module>
    import botocore.credentials
  File "/usr/lib/python3/dist-packages/botocore/credentials.py", line 24, in <module>
    import requests
  File "/usr/lib/python3/dist-packages/requests/__init__.py", line 58, in <module>
    from . import utils
  File "/usr/lib/python3/dist-packages/requests/utils.py", line 25, in <module>
    from .compat import parse_http_list as _parse_list_header
  File "/usr/lib/python3/dist-packages/requests/compat.py", line 105, in <module>
    from http import cookiejar as cookielib
  File "/usr/lib/python3.4/http/cookiejar.py", line 39, in <module>
    import dummy_threading as _threading
  File "/usr/lib/python3.4/dummy_threading.py", line 45, in <module>
    import threading
ImportError: No module named 'threading'

I downgraded python to 3.4.0-2ubuntu1 and it's working again

root@mesosm03:~# apt-get install python3.4=3.4.0-2ubuntu1 python3.4-dev=3.4.0-2ubuntu1 python3.4-minimal=3.4.0-2ubuntu1 libpython3.4:amd64=3.4.0-2ubuntu1 libpython3.4-dev:amd64=3.4.0-2ubuntu1 libpython3.4-minimal:amd64=3.4.0-2ubuntu1 libpython3.4-stdlib:amd64=3.4.0-2ubuntu1
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for mime-support (3.54ubuntu1.1) ...
Setting up libpython3.4-minimal:amd64 (3.4.0-2ubuntu1) ...
Setting up python3.4-minimal (3.4.0-2ubuntu1) ...
Setting up libpython3.4-stdlib:amd64 (3.4.0-2ubuntu1) ...
Setting up python3.4 (3.4.0-2ubuntu1) ...
Setting up libpython3.4:amd64 (3.4.0-2ubuntu1) ...
Setting up libpython3.4-dev:amd64 (3.4.0-2ubuntu1) ...
Setting up python3.4-dev (3.4.0-2ubuntu1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
root@mesosm03:~# aws
usage: aws [options] <command> <subcommand> [parameters]
aws: error: the following arguments are required: command

The downgrade to 3.4.0-2ubuntu1 did not work for me. Now I get another error

root@uh-mgmt:/home/ubuntu# apt-get install python3.4=3.4.0-2ubuntu1 python3.4-dev=3.4.0-2ubuntu1 python3.4-minimal=3.4.0-2ubuntu1 li                                                                                                                                           bpython3.4:amd64=3.4.0-2ubuntu1 libpython3.4-dev:amd64=3.4.0-2ubuntu1 libpython3.4-minimal:amd64=3.4.0-2ubuntu1 libpython3.4-stdlib:                                                                                                                                           amd64=3.4.0-2ubuntu1
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  python3.4-doc binfmt-support
The following packages will be DOWNGRADED:
  libpython3.4 libpython3.4-dev libpython3.4-minimal libpython3.4-stdlib
  python3.4 python3.4-dev python3.4-minimal
0 upgraded, 0 newly installed, 7 downgraded, 0 to remove and 4 not upgraded.
Need to get 0 B/32.6 MB of archives.
After this operation, 11.5 MB of additional disk space will be used.
Do you want to continue? [Y/n]
dpkg: warning: downgrading python3.4-dev from 3.4.3-1ubuntu1~14.04.1 to 3.4.0-2ubuntu1
(Reading database ... 61913 files and directories currently installed.)
Preparing to unpack .../python3.4-dev_3.4.0-2ubuntu1_amd64.deb ...
Unpacking python3.4-dev (3.4.0-2ubuntu1) over (3.4.3-1ubuntu1~14.04.1) ...
dpkg: warning: downgrading libpython3.4-dev:amd64 from 3.4.3-1ubuntu1~14.04.1 to 3.4.0-2ubuntu1
Preparing to unpack .../libpython3.4-dev_3.4.0-2ubuntu1_amd64.deb ...
Unpacking libpython3.4-dev:amd64 (3.4.0-2ubuntu1) over (3.4.3-1ubuntu1~14.04.1) ...
dpkg: warning: downgrading libpython3.4:amd64 from 3.4.3-1ubuntu1~14.04.1 to 3.4.0-2ubuntu1
Preparing to unpack .../libpython3.4_3.4.0-2ubuntu1_amd64.deb ...
Unpacking libpython3.4:amd64 (3.4.0-2ubuntu1) over (3.4.3-1ubuntu1~14.04.1) ...
dpkg: warning: downgrading python3.4 from 3.4.3-1ubuntu1~14.04.1 to 3.4.0-2ubuntu1
Preparing to unpack .../python3.4_3.4.0-2ubuntu1_amd64.deb ...
Unpacking python3.4 (3.4.0-2ubuntu1) over (3.4.3-1ubuntu1~14.04.1) ...
dpkg: warning: downgrading libpython3.4-stdlib:amd64 from 3.4.3-1ubuntu1~14.04.1 to 3.4.0-2ubuntu1
Preparing to unpack .../libpython3.4-stdlib_3.4.0-2ubuntu1_amd64.deb ...
Unpacking libpython3.4-stdlib:amd64 (3.4.0-2ubuntu1) over (3.4.3-1ubuntu1~14.04.1) ...
Replaced by files in installed package libpython3.4-minimal:amd64 (3.4.3-1ubuntu1~14.04.1) ...
dpkg: warning: downgrading python3.4-minimal from 3.4.3-1ubuntu1~14.04.1 to 3.4.0-2ubuntu1
Preparing to unpack .../python3.4-minimal_3.4.0-2ubuntu1_amd64.deb ...
Unpacking python3.4-minimal (3.4.0-2ubuntu1) over (3.4.3-1ubuntu1~14.04.1) ...
dpkg: warning: downgrading libpython3.4-minimal:amd64 from 3.4.3-1ubuntu1~14.04.1 to 3.4.0-2ubuntu1
Preparing to unpack .../libpython3.4-minimal_3.4.0-2ubuntu1_amd64.deb ...
Unpacking libpython3.4-minimal:amd64 (3.4.0-2ubuntu1) over (3.4.3-1ubuntu1~14.04.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for mime-support (3.54ubuntu1.1) ...
Setting up libpython3.4-minimal:amd64 (3.4.0-2ubuntu1) ...
Setting up python3.4-minimal (3.4.0-2ubuntu1) ...
Setting up libpython3.4-stdlib:amd64 (3.4.0-2ubuntu1) ...
Setting up python3.4 (3.4.0-2ubuntu1) ...
Setting up libpython3.4:amd64 (3.4.0-2ubuntu1) ...
Setting up libpython3.4-dev:amd64 (3.4.0-2ubuntu1) ...
Setting up python3.4-dev (3.4.0-2ubuntu1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
root@uh-mgmt:/home/ubuntu# aws
Traceback (most recent call last):
  File "/usr/lib/python3.4/http/cookiejar.py", line 37, in <module>
    import threading as _threading
ImportError: No module named 'threading'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/aws", line 15, in <module>
    import awscli.clidriver
  File "/usr/share/awscli/awscli/clidriver.py", line 16, in <module>
    import botocore.session
  File "/usr/lib/python3/dist-packages/botocore/session.py", line 35, in <module>
    import botocore.credentials
  File "/usr/lib/python3/dist-packages/botocore/credentials.py", line 24, in <module>
    import requests
  File "/usr/lib/python3/dist-packages/requests/__init__.py", line 58, in <module>
    from . import utils
  File "/usr/lib/python3/dist-packages/requests/utils.py", line 25, in <module>
    from .compat import parse_http_list as _parse_list_header
  File "/usr/lib/python3/dist-packages/requests/compat.py", line 105, in <module>
    from http import cookiejar as cookielib
  File "/usr/lib/python3.4/http/cookiejar.py", line 39, in <module>
    import dummy_threading as _threading
  File "/usr/lib/python3.4/dummy_threading.py", line 45, in <module>
    import threading
ImportError: No module named 'threading'

Didn't work for me either actually I get the threading error as well.

I got it working. Pip install upgrade botocore and awscli.

The version of the CLI installed via apt-get is out of date. Python 3.4.1 introduced a breaking change with the getargspec() function, which we use in botocore. This was resolved on our end, but we do not maintain the ubuntu package, so we cannot update it ourselves. I'm opening a bug report, hopefully they can update it on their end.

Updating awscli via pip did the job. Thank you @Aeramor @JordonPhillips !

I have same problem.

awscli/trusty,now 1.2.9-2 looks broken

see below.
https://bugs.launchpad.net/ubuntu/+source/awscli/+bug/1499063

@umiyosh I already submitted a bug report, so I marked yours as a duplicate. That escalates the 'heat' of the issue a great deal, which is great. For anybody else being affected, marking yourself as affected and subscribing to the issue will further raise the heat. I'm trying to get in contact with canonical, but I don't have a direct contact with the team that maintains the package. I'll update on this github issue when I have any new information. Again, I highly recommend using pip instead of aptitude. That will allow you to get bug fixes and new features ASAP.

Bug report: https://bugs.launchpad.net/ubuntu/+source/awscli/+bug/1501042

For a workaround, based on what @Aeramor said I did this:

sudo apt-get remove awscli
sudo apt-get install python-pip
sudo pip install awscli

which fixed things for me :)

The downgrade to 3.4.0-2ubuntu1 did not work for me. Now I get another error
[...]
ImportError: No module named 'threading'

I ran into the same issue (for downgrading to 3.4.0-2ubuntu1.1 versions).
Running the downgrade twice reliably worked across all of our ~20 affected hosts:

sudo apt-get install --reinstall python3.4=3.4.0-2ubuntu1.1 libpython3.4-stdlib=3.4.0-2ubuntu1.1 python3.4-minimal=3.4.0-2ubuntu1.1 libpython3.4-minimal=3.4.0-2ubuntu1.1
sudo apt-get install --reinstall python3.4=3.4.0-2ubuntu1.1 libpython3.4-stdlib=3.4.0-2ubuntu1.1 python3.4-minimal=3.4.0-2ubuntu1.1 libpython3.4-minimal=3.4.0-2ubuntu1.1
sudo apt-mark hold python3.4 libpython3.4-stdlib python3.4-minimal libpython3.4-minimal

and gave us a working aws cli again (with packages from apt instead of pip).

I finally got into contact with somebody at Canonical. Looks like there's a fix in the works in the 'proposed' channel. To fix the issue without downgrading / locking python to version 3.4.0, perform the following:

First, enable the proposed repo

sudo apt-get -y remove awscli python3-botocore
sudo apt-get update
sudo apt-get -y install awscli
aws --version

No word on how long it will take to reach the main repository, but based on their update procedures it looks like it'll be somewhere in the neighborhood of a week or more. We've opened a priority support ticket requesting expedited escalation to the main update channel, so hopefully it'll be sooner than that.

At the risk of sounding like a broken record, I highly recommend you use pip instead of aptitude to install the cli. It's the only way to be sure you're getting the latest features and bug fixes since we directly control that package.

Note that python3.4 version 3.4.3-1ubuntu1~14.04.1 has just been pulled from the trusty-updates channel due to a different unrelated regression, so this bug will no longer (currently) affect new 14.04 systems installing from the normal apt packages.

To downgrade and remove the now-pulled package upgrade, the suggestion provided by @somechris worked for my hosts (the last line apt-mark hold was not needed, now that the 3.4.3 package update is no longer present).

Hopefully the botocore update makes it into trusty-updates channel before the Python 3.4.3 upgrade is reintroduced there.

The botocore update has made its way into the stable update channel as of last night. When python 3.4.3 is reintroduced, the issue should no longer be present.

https://bugs.launchpad.net/ubuntu/+source/python-botocore/+bug/1499075

@JordonPhillips Thanks, it works.

Still experiencing same issue on Ubuntu 14.04, tried the mentioned fix (removing python3.4 and reinstalling), no dice.

The version of python is:

Version: 3.4.3-1ubuntu1~14.04.5

I went for the pip solution.

it worked for me
$ sudo pip3 uninstall awscli
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.4 1
$ sudo pip3 install awscli

Still has the same issue on Ubuntu 14.04.

It worked for me:

sudo apt-get uninstall awscli
sudo pip uninstall boto3
sudo pip uninstall botocore
sudo pip install awscli
Was this page helpful?
0 / 5 - 0 ratings