简体   繁体   中英

awscli not working on OS X, keep getting ImportError: No module named awscli_plugin_endpoint

I recently broke my awscli installation by doing a brew upgrade . I keep getting

ImportError: No module named awscli_plugin_endpoint

regardless of what python version I use.

Here's what I've tried already:

  • current python version coming with brew using brew install awscli ,
  • pyenv with 2.7.14 and 3.6.4,
  • virtualenv using this gist ,
  • pyenv with this other gist .
  • install the tarballs manually from 1.14.65 - to 1.14.62.

No matter what I do, it always complains about

No module named awscli_plugin_endpoint

I've already wiped the complete brew install, wiped all pyenvs, removed dot dirs .local , .pyenv . The only thing that is still there is the system install python coming with OS X.

Running OS X 10.13.3, using zsh .

What is wrong here?

Example stacktrace from Python 2.7:

$ aws --version
Traceback (most recent call last):
  File "/Users/dhiller/pyenvs/aws/bin/aws", line 27, in <module>
    sys.exit(main())
  File "/Users/dhiller/pyenvs/aws/bin/aws", line 23, in main
    return awscli.clidriver.main()
  File "/Users/dhiller/pyenvs/aws/lib/python2.7/site-packages/awscli/clidriver.py", line 58, in main
    driver = create_clidriver()
  File "/Users/dhiller/pyenvs/aws/lib/python2.7/site-packages/awscli/clidriver.py", line 69, in create_clidriver
    event_hooks=emitter)
  File "/Users/dhiller/pyenvs/aws/lib/python2.7/site-packages/awscli/plugin.py", line 44, in load_plugins
    modules = _import_plugins(plugin_mapping)
  File "/Users/dhiller/pyenvs/aws/lib/python2.7/site-packages/awscli/plugin.py", line 58, in _import_plugins
    plugins.append(__import__(path))
ImportError: No module named awscli_plugin_endpoint

The solution was simple - just use the pip that's matching the python installation to install the endpoint manually :

# this also installs python as a dependency
$ brew install awscli
$ /usr/local/opt/awscli/libexec/bin/pip install awscli-plugin-endpoint
$ aws --version                                                                                                                                                     
aws-cli/1.14.60 Python/3.6.4 Darwin/17.4.0 botocore/1.9.13

Or remove the plugin entry in ~/.aws/config :

[plugins]
endpoint = awscli_plugin_endpoint

I have to admit, this took me longer than it should have, and this is probably not the best way to go about it, but my version of aws doesn't have pip, so I just copied over the plugin (needed admin priviledges to do this)

C:\Users\blackstrype>pip install awscli-plugin-endpoint
Requirement already satisfied: awscli-plugin-endpoint in *__c:\users\blackstrype\appdata\local\programs\python\python38-32\lib\site-packages__* (0.4)
Requirement already satisfied: awscli>=1.11.0 in c:\users\blackstrype\appdata\local\programs\python\python38-32\lib\site-packages (from awscli-plugin-endpoint) (1.18.138)
Requirement already satisfied: docutils<0.16,>=0.10 in c:\users\blackstrype\appdata\local\programs\python\python38-32\lib\site-packages (from awscli>=1.11.0->awscli-plugin-endpoint) (0.15.2)
Requirement already satisfied: colorama<0.4.4,>=0.2.5; python_version != "3.4" in c:\users\blackstrype\appdata\local\programs\python\python38-32\lib\site-packages (from awscli>=1.11.0->awscli-plugin-endpoint) (0.4.3)

Copy C:\\users\\blackstrype\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages\\awscli-plugin-endpoint* to C:\\Program Files\\Amazon\\AWSCLI\\runtime\\Lib\\site-packages

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM