Aws-cli: Fail to install aws-cli via sudo pip install awscli

Created on 23 Sep 2015  ·  39Comments  ·  Source: aws/aws-cli

I'm on El Capitan OSX. Got following error:

Installing collected packages: six, python-dateutil, docutils, botocore, pyasn1, rsa, awscli
Found existing installation: six 1.4.1
DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 211, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 311, in run
root=options.root_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 640, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 716, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 125, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip/utils/init.py", line 315, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-ion1Bt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
Bournes-MacBook-Pro:~ BourneWang$

closing-soon guidance

Most helpful comment

After many many attempts, the following finally got awscli installed on El Capitan (bare metal, not virtual):

sudo -H pip install awscli --upgrade --ignore-installed six

All 39 comments

This looks like something with how pip handles uninstalling libraries that it did not install in the first place, in this case looks like libraries installed with disutils. It might be worth looking around the pypa github org to see if there is any workarounds they suggest.

One question that I have is are running this from a virtual environment created from virtualenv? It might be worth looking into that so you can avoid uninstalling dependencies that are installed system wide, and it will isolate all dependencies to that environment so you should be able to avoid such errors. Let me know if that helps.

Same issue with me, El Captain as well... I'll check on pip repository if there's any solution...

Hitting the same error using El Capitan also.

Same issue here on El Capitan. To @kyleknap question I am not on a virtual machine.

bump on this, El Capitan not running from virtualenv

Same issue here on El Capitan.

Submitted as pip issue: https://github.com/pypa/pip/issues/3165

This looks like an issue with pip / El Capitan. Since @jtkinser opened an issue with pip, I'm gonna close out the issue here.

I am having the same issue:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 211, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 311, in run
root=options.root_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 640, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 716, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 125, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip/utils/init.py", line 315, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/var/folders/c3/xn7lnb2x6bb3413qvq135tt40000gn/T/pip-NsJxa7-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'

I'm having the exact same issue. Has anybody found a fix or workaround for this yet?

After many many attempts, the following finally got awscli installed on El Capitan (bare metal, not virtual):

sudo -H pip install awscli --upgrade --ignore-installed six

@mmtsweng that was it. thanks!

I'm almost positive this is due to the new System Integrity Protection. I suggest not trying to update/use the system version of python...try a brewed version.

Thanks @mmtsweng

Thanks @mmtsweng, that worked finally!!!!

:100: kudos go to @mmtsweng

thanks @mmtsweng

Thanks @mmtsweng

Thanks @mmtsweng that did the trick!

Ditto for me!

@mmtsweng that worked for me thanks!

@mmtsweng Tank you!

Thanks @mmtsweng! Saved my morning from diving into my python setup

Much appreciated, @mmtsweng!

Thx @mmtsweng !
just perfect :+1:
sudo -H pip install awscli --upgrade --ignore-installed six

Thanks for the help @mmtsweng

Thanks @mmtsweng.. it worked !!!!!!!!!!!!

kudos go to @mmtsweng

you are a life saver @mmtsweng

I used pip install --upgrade awscli --user and it worked.

@mmtsweng Thank you!

Worked!! Thanks!

Spot on thanks!
sudo -H pip install awscli --upgrade --ignore-installed six

@mmtsweng now 2018, still worked 👍

@mmtsweng
you save me. it's still worked on macOS highsierra 10.13.5

@mmtsweng right on! Thanks 👍

@mmtsweng Mojave public beta working! Thanks!

@mmtsweng Thanks! It worked!

@mmtsweng Its 2019 and it did work for me, Thanks!

Was this page helpful?
0 / 5 - 0 ratings