[issue28440] pip failures on macOS Sierra

Marc Culler report at bugs.python.org
Fri Oct 14 09:09:00 EDT 2016


New submission from Marc Culler:

Changes made to /Library/Python on macOSX Sierra cause the --with-ensurepip compiler flag to fail, and lead to failures of pip after installing Python.

The new file that causes the problem on Sierra is:
/Library/Python/2.7/site-packages/Extras.pth
The current version of site.py reads that .pth file, which results in sys.path containing the path:
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
The latter directory (which is protected by SIP) contains many Python 2.7 packages, including easy_install, setuptools, six, py2app, numpy, pylab and pyOpenSSL.  The effect of including this SIP-protected path in sys.path is this:  installing or upgrade a package in /Library/Frameworks/Python.framework which is also installed as an "Extra" in the /System/Frameworks/Python.framework will cause pip to attempt to delete the "old" package from its SIP-protected directory, leading to a "Permission Denied" exception and a failed install.

Given that Apple has now tied /Library/Python to the system Python in this way, thereby making a separate Python framework in /Library/Frameworks unusable, the natural solution to this problem would be to stop including any /Library/Python paths in sys.path.

I am attaching a patch that removes the block of code in site.py which adds these paths.

----------
files: pipfails.patch
keywords: patch
messages: 278649
nosy: Marc.Culler
priority: normal
severity: normal
status: open
title: pip failures on macOS Sierra
type: compile error
Added file: http://bugs.python.org/file45090/pipfails.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28440>
_______________________________________


More information about the Python-bugs-list mailing list