Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aws-cli run error in linux #800

Closed
riston opened this issue May 31, 2014 · 26 comments · Fixed by boto/botocore#300
Closed

Aws-cli run error in linux #800

riston opened this issue May 31, 2014 · 26 comments · Fixed by boto/botocore#300

Comments

@riston
Copy link

riston commented May 31, 2014

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
@riston riston changed the title Running to error when trying to run aws-cli Aws-cli run error. May 31, 2014
@riston riston changed the title Aws-cli run error. Aws-cli run error in linux May 31, 2014
@dpak101
Copy link

dpak101 commented Jun 2, 2014

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.

@jamesls
Copy link
Member

jamesls commented Jun 3, 2014

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

@jamesls
Copy link
Member

jamesls commented Jun 4, 2014

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

@riston
Copy link
Author

riston commented Jun 4, 2014

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

@jamesls
Copy link
Member

jamesls commented Jun 4, 2014

Now fixed in boto/botocore#300

@jamesls jamesls closed this as completed Jun 4, 2014
@muad-dweeb
Copy link

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

@ghost
Copy link

ghost commented Sep 28, 2015

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

Currently on Python 3.4.3

@BradErz
Copy link

BradErz commented Sep 28, 2015

Im also having the same issue with ubuntu 14.04.

@twistedpair
Copy link

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

@taik0
Copy link

taik0 commented Sep 29, 2015

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

@JackSW
Copy link

JackSW commented Sep 29, 2015

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'

@Aeramor
Copy link

Aeramor commented Sep 29, 2015

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

@Aeramor
Copy link

Aeramor commented Sep 29, 2015

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

@JordonPhillips
Copy link
Member

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.

@muad-dweeb
Copy link

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

@umiyosh
Copy link

umiyosh commented Sep 30, 2015

I have same problem.

awscli/trusty,now 1.2.9-2 looks broken

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

@JordonPhillips
Copy link
Member

@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

@michaeltandy
Copy link

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 :)

@somechris
Copy link

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).

@JordonPhillips
Copy link
Member

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.

@wjordan
Copy link

wjordan commented Oct 6, 2015

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.

@JordonPhillips
Copy link
Member

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

@kevingo
Copy link

kevingo commented Nov 6, 2015

@JordonPhillips Thanks, it works.

@gm42
Copy link

gm42 commented Dec 27, 2016

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.

@eldahroug
Copy link

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

@cisiqo
Copy link

cisiqo commented Jan 6, 2020

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

thoward-godaddy pushed a commit to thoward-godaddy/aws-cli that referenced this issue Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.