pip install --upgrade setuptools

Created on 25 Apr 2018  ·  13Comments  ·  Source: pypa/pip

  • Pip version: 10.0.1
  • Python version: 2.7
  • Operating system: MacOS

Description:

I am trying to upgrade setuptools. but am stuck with an error.

What I've run:

pip install --upgrade setuptools

sh-3.2# pip install --upgrade setuptools
Collecting setuptools
Using cached https://files.pythonhosted.org/packages/20/d7/04a0b689d3035143e2ff288f4b9ee4bf6ed80585cc121c90bfd85a1a8c2e/setuptools-39.0.1-py2.py3-none-any.whl
matplotlib 1.3.1 requires nose, which is not installed.
Installing collected packages: setuptools
Found existing installation: setuptools 18.5
Uninstalling setuptools-18.5:
Could not install packages due to an EnvironmentError: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', '/private/tmp/pip-uninstall-2rF8Fc/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2rF8Fc/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', '/private/tmp/pip-uninstall-2rF8Fc/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2rF8Fc/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', '/private/tmp/pip-uninstall-2rF8Fc/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2rF8Fc/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', '/private/tmp/pip-uninstall-2rF8Fc/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2rF8Fc/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', '/private/tmp/pip-uninstall-2rF8Fc/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2rF8Fc/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib'")]

Please let me know how to fix this.

macos support

Most helpful comment

@katydid98
I solved this problem by
"sudo pip install packagename --upgrade --ignore-installed"

All 13 comments

I am facing the same issue. Any solution to this??

You're trying to modify your OS-installed Python. Don't try that.

I suggest you get a separate Python installation (I do this) -- brew install python should suffice.

@pradyunsg
Thank you for your answer. I face the same problem too...

But I don't really understand what do you mean "separate Python installation"?
How do this "brew install python" suppose to run?

Thank you!

I'm facing the same problem and was wondering if anyone figured out a fix?

Using also the following:
Pip version: 10.0.1
Python version: 2.7
Operating system: MacOS (Sierra)

@katydid98
I solved this problem by
"sudo pip install packagename --upgrade --ignore-installed"

@shihs You shouldn't run pip with sudo. https://stackoverflow.com/questions/21055859/what-are-the-risks-of-running-sudo-pip

Homebrew is a tool to install developer tools on MacOS. Running brew install python in the terminal, after installing Homebrew, would install another Python which is not involved in the operating system's working. After that, pip should work as you expect it to.

Hey @pradyunsg
THANK YOU SO MUCH! I understand now!

Issue with scrapy installation i have resolved with bellow command.
Could not install packages due to an EnvironmentError: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/zope/__init__.py'

sudo pip install scrapy --upgrade --ignore-installed

@shihs @Nanhekumar, it works, thanks.

Hello from 2019 guys

@dbof10 the error message from the OS makes it pretty clear that there is a permission problem, i'm affraid further comments will dilute @pradyunsg's explanation into many more comments as such perhaps this issue should be closed / locked ?

Agreed. The root cause here is that you should never run pip as root (either directly or via sudo) as it will cause issues.

Locking since I don't want to address this more times -- just, don't use pip with sudo or as root.

See https://github.com/pypa/pip/issues/5329#issuecomment-392693882.

Was this page helpful?
0 / 5 - 0 ratings