aws-cli icon indicating copy to clipboard operation
aws-cli copied to clipboard

ImportError: No module named pyasn1.error

Open glaksmono opened this issue 10 years ago • 14 comments

Any ideas what may caused this?

➜  ~ aws help
Traceback (most recent call last):
  File "/usr/local/bin/aws", line 27, in <module>
    sys.exit(main())
  File "/usr/local/bin/aws", line 23, in main
    return awscli.clidriver.main()
  File "/Library/Python/2.7/site-packages/awscli/clidriver.py", line 49, in main
    driver = create_clidriver()
  File "/Library/Python/2.7/site-packages/awscli/clidriver.py", line 58, in create_clidriver
    event_hooks=emitter)
  File "/Library/Python/2.7/site-packages/awscli/plugin.py", line 44, in load_plugins
    modules = _import_plugins(plugin_mapping)
  File "/Library/Python/2.7/site-packages/awscli/plugin.py", line 61, in _import_plugins
    module = __import__(path, fromlist=[module])
  File "/Library/Python/2.7/site-packages/awscli/handlers.py", line 30, in <module>
    from awscli.customizations.cloudtrail import initialize as cloudtrail_init
  File "/Library/Python/2.7/site-packages/awscli/customizations/cloudtrail/__init__.py", line 14, in <module>
    from .validation import CloudTrailValidateLogs
  File "/Library/Python/2.7/site-packages/awscli/customizations/cloudtrail/validation.py", line 25, in <module>
    from pyasn1.error import PyAsn1Error
ImportError: No module named pyasn1.error
➜  ~

I tried to upgrade:

➜  ~ pip install --upgrade awscli
Requirement already up-to-date: awscli in /Library/Python/2.7/site-packages
Cleaning up...

Thoughts?

glaksmono avatar Jun 28 '16 14:06 glaksmono

I figured:

Upgrade PIP

➜  Documents sudo pip install --upgrade pip
Password:
Downloading/unpacking pip from https://pypi.python.org/packages/9c/32/004ce0852e0a127f07f358b715015763273799bd798956fa930814b60f39/pip-8.1.2-py2.py3-none-any.whl#md5=0570520434c5b600d89ec95393b2650b
  Downloading pip-8.1.2-py2.py3-none-any.whl (1.2MB): 1.2MB downloaded
Installing collected packages: pip
  Found existing installation: pip 1.5.4
    Uninstalling pip:
      Successfully uninstalled pip
Successfully installed pip
Cleaning up...

Then upgrade the aws cli

➜  Documents sudo pip install awscli --ignore-installed six
The directory '/Users/glaksmono/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/glaksmono/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting awscli
  Downloading awscli-1.10.43-py2.py3-none-any.whl (969kB)
    100% |████████████████████████████████| 972kB 413kB/s
Collecting six
  Downloading six-1.10.0-py2.py3-none-any.whl
Collecting docutils>=0.10 (from awscli)
  Downloading docutils-0.12.tar.gz (1.6MB)
    100% |████████████████████████████████| 1.6MB 179kB/s
Collecting colorama<=0.3.3,>=0.2.5 (from awscli)
  Downloading colorama-0.3.3.tar.gz
Collecting s3transfer==0.0.1 (from awscli)
  Downloading s3transfer-0.0.1-py2.py3-none-any.whl
Collecting rsa<=3.5.0,>=3.1.2 (from awscli)
  Downloading rsa-3.4.2-py2.py3-none-any.whl (46kB)
    100% |████████████████████████████████| 51kB 860kB/s
Collecting botocore==1.4.33 (from awscli)
  Downloading botocore-1.4.33-py2.py3-none-any.whl (2.4MB)
    100% |████████████████████████████████| 2.4MB 360kB/s
Collecting futures<4.0.0,>=2.2.0; python_version == "2.6" or python_version == "2.7" (from s3transfer==0.0.1->awscli)
  Downloading futures-3.0.5-py2-none-any.whl
Collecting pyasn1>=0.1.3 (from rsa<=3.5.0,>=3.1.2->awscli)
  Downloading pyasn1-0.1.9-py2.py3-none-any.whl
Collecting python-dateutil<3.0.0,>=2.1 (from botocore==1.4.33->awscli)
  Downloading python_dateutil-2.5.3-py2.py3-none-any.whl (201kB)
    100% |████████████████████████████████| 204kB 464kB/s
Collecting jmespath<1.0.0,>=0.7.1 (from botocore==1.4.33->awscli)
  Downloading jmespath-0.9.0-py2.py3-none-any.whl
Installing collected packages: docutils, colorama, futures, six, python-dateutil, jmespath, botocore, s3transfer, pyasn1, rsa, awscli
  Running setup.py install for docutils ... done
  Running setup.py install for colorama ... done
Successfully installed awscli-1.10.42 botocore-1.4.32 colorama-0.3.3 docutils-0.12 futures-3.0.5 jmespath-0.9.0 pyasn1-0.1.9 python-dateutil-1.5 rsa-3.4.2 s3transfer-0.0.1 six-1.4.1
➜  Documents aws --help
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help
aws: error: too few arguments
➜  Documents aws --version
aws-cli/1.10.43 Python/2.7.10 Darwin/15.5.0 botocore/1.4.33
➜  Documents

glaksmono avatar Jun 29 '16 07:06 glaksmono

Works, Thanks !!

dshweta avatar Dec 16 '16 20:12 dshweta

Just tested it ; I can confirm solution is working as of Aug. 2017.

jazlopez avatar Aug 18 '17 01:08 jazlopez

Thanks a lot, i had the same issue. It worked after upgrading pip.

SkBalaDRG avatar Nov 06 '17 13:11 SkBalaDRG

Still the solution as of March 2018

rickkuilman avatar Mar 02 '18 12:03 rickkuilman

Still the solution as of January 2019

rodnaph avatar Jan 21 '19 21:01 rodnaph

Still the solution as of April 2019

saurabhdaga1 avatar Apr 18 '19 14:04 saurabhdaga1

Still the solution as of May 2019

temunix2 avatar May 23 '19 17:05 temunix2

Still the solution as of September 2019

ab-gh avatar Sep 30 '19 11:09 ab-gh

Still the solution as of October 2019

pku-wuwei avatar Oct 20 '19 05:10 pku-wuwei

This worked for me:

pip3 install awscli --upgrade --user

from aws doc

jouellnyc avatar Dec 10 '19 02:12 jouellnyc

Still the solution as of May 2020

jkparuchuri avatar May 02 '20 20:05 jkparuchuri

Still solution as of May 2021 👍

cleggypdc avatar May 19 '21 11:05 cleggypdc

Still the solution as of August 2024

dwrolvink avatar Aug 13 '24 11:08 dwrolvink