awscli fails to work: No module named 'awscli'
I am trying to install awscli using pip3 on Linux Mint 17.2 Rafaela.
I am getting the error:
Traceback (most recent call last):
File "/home/jonathan/.local/bin/aws", line 19, in <module>
import awscli.clidriver
ImportError: No module named 'awscli'
These are the steps I am taking, following the aws installation guide:
sudo pip install awscli --upgrade --user
everything seems to install fine.
adding to my .bashrc
export PATH=~/.local/bin:$PATH
then
source ~/.bashrc
then i try the command
aws --version
and i get
Traceback (most recent call last):
File "/home/jonathan/.local/bin/aws", line 19, in <module>
import awscli.clidriver
ImportError: No module named 'awscli'
Can anyone help with this?
EDIT: For anyone visiting this question. There is no way I can test any of these answers because I have since removed this OS and installed Ubuntu. Also I have no need for awscli anymore.
Solution 1:
I had the same issue. I realized that awscli wasn't installed in /usr/local/lib/python3.5
but instead in /.local/usr
. So i uninstalled awscli using
sudo pip3 uninstall awscli
and just used this
sudo pip3 install awscli
that solved the issue for me. Now aws --version
is working perfectly.
Also make sure you remove all the dependencies of awscli which were installed in the /.local
folder, you can simply uninstall all of them, and then run the above command.
Solution 2:
On Windows 10 64bit I was getting the same error.
I have Python 2.7 and 3.7 installed on my PC. I tried the installing awscli using both of the following commands:
pip install --upgrade --user awscli
pip install awscli
I uninstalled the awscli using pip after using the first command.
After running the second command the error message persisted.
I solved the problem by changing the order of paths to search in my "System" PATH variable.
My "System" PATH variable looked like this:
C:\Program Files\Python\Python27\
C:\Program Files\Python\Python27\Scripts
C:\Program Files\Python\Python37\
C:\Program Files\Python\Python37\Scripts
So I used the "Move Up/ Down" buttons in the Environment Variables Control Panel to change the order to look like this:
C:\Program Files\Python\Python37\
C:\Program Files\Python\Python37\Scripts
C:\Program Files\Python\Python27\
C:\Program Files\Python\Python27\Scripts
Now the awscli is running without issues.