This has been happening for a few weeks now, not sure what's causing it but it's happening on 2 separate mac's.
Every time I come to run aws s3 command
I get the following error:
```Traceback (most recent call last):
File "/Users/danwilliams/Library/Python/3.6/bin/aws", line 27, in
sys.exit(main())
File "/Users/danwilliams/Library/Python/3.6/bin/aws", line 23, in main
return awscli.clidriver.main()
File "/Users/danwilliams/Library/Python/3.6/lib/python/site-packages/awscli/clidriver.py", line 58, in main
driver = create_clidriver()
File "/Users/danwilliams/Library/Python/3.6/lib/python/site-packages/awscli/clidriver.py", line 68, in create_clidriver
event_hooks=session.get_component('event_emitter'))
File "/Users/danwilliams/Library/Python/3.6/lib/python/site-packages/awscli/plugin.py", line 44, in load_plugins
modules = _import_plugins(plugin_mapping)
File "/Users/danwilliams/Library/Python/3.6/lib/python/site-packages/awscli/plugin.py", line 61, in _import_plugins
module = __import__(path, fromlist=[module])
File "/Users/danwilliams/Library/Python/3.6/lib/python/site-packages/awscli/handlers.py", line 20, in
from awscli.paramfile import register_uri_param_handler
File "/Users/danwilliams/Library/Python/3.6/lib/python/site-packages/awscli/paramfile.py", line 18, in
from botocore.httpsession import URLLib3Session
ModuleNotFoundError: No module named 'botocore.httpsession'
```
If I simply try to reinstall the awscli
I get an error which ends with:
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/site-packages/urllib3-1.24.1.dist-info/RECORD'
I have to use the following command to successfully reinstall pip install awscli --force-reinstall --upgrade --user
And then I'll come back a few days later to run aws s3 command
and the same error/process will have to happen again!
@djw27 - Thank you for reporting this issue. The error details were helpful but excluded the CLI and botocore version in use so I'm limited to reproducing this issue. The output from the following command would help me understand the problem better:
aws --version
pip check
pip freeze
Initially when we see ModuleNotFoundError: No module named 'botocore.httpsession'
it is indication there is an issue with the version of botocore. Sometimes this can be caused by a bad installation or multiple installations such as initially installing the CLI using apt-get
and later installing it with pip install
.
As to the permission denied
error, may be related to the lack of write permissions to the /usr directory which seems to be a known pip issue..
As such, it is recommended to completely uninstall the CLI and reinstall the latest version. The latest CLI version is using botocore ==1.12.96.
@justnance thanks for the response. I'm going to put this down to an issue with my system, like you suggested...
I couldn't even run aws --version
which clearly indicated something was wrong...
Anyway, I had to run pip uninstall awscli
3 times to full uninstall the CLI as it was installed in various locations for whatever reason.
Along the way I had to follow this StackOverflow answer to remove some badly named files in my site-packages.
Issues seem resolved for now!
FYI I had this problem too: the reason was that awscli was not installed in my virtualenv, and some tools were (quite transparently and non-intuitively) falling back to the system-installed version of aws
which was certainly much older than my fresh virtualenv.
Adding awscli to my virtualenv requirements fixed my problem (and refreshing everything, because just installing awscli was not enough, I had to deactivate and reactivate the virtualenv).
i fixed this with mv ~/.local/lib ~/.local/lib.ick
.
Update aws Cli to aws-cli/2.0.50 Python/3.7.3 Linux/5.4.0-48-generic exe/x86_64.ubuntu.20
,it will work.
Most helpful comment
i fixed this with
mv ~/.local/lib ~/.local/lib.ick
.