[Pythonmac-SIG] PyObjC and macOS 10.12 (Sierra)
Jack Jansen
jack.jansen at cwi.nl
Tue Sep 13 15:05:33 EDT 2016
I think /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages is a very old location for storing Python packages. Recently things have been installed in /Library/Python/2.7/site-packages.
Could it be that you’ve installed pyobjc a couple of OSX releases ago?
And could it be that the OSX upgrade that introduced SIP somehow didn’t clean out user-installed things from /Library/Frameworks before turning off write permission?
A possible workaround is to turn off SIP (or boot from the recovery partition), record what is in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages and then clean it out. Then after a reboot re-install the packages you’re still using.
Jack
> On 13-Sep-2016, at 20:50 , Andrew Jaffe <a.h.jaffe at gmail.com> wrote:
>
> Dear Chris and Glyph,
>>
>> On Sunday, September 11, 2016, Andrew Jaffe <a.h.jaffe at gmail.com> wrote:
>> Dear Ronald,
>>
>> Thanks, as usual, for all this.
>>
>> I have upgraded to the GM version of 10.12 on the beta track. I use the python.org framework builds of python.
>>
>> When I do "pip list --outdated", I get a long list:
>
> ….
>
>> If I do the usual "pip --upgrade" for these, it fails, seemingly because of permissions (Apologies, but I don't have access to the messages anymore): it is clearly trying to delete these versions which seem to live in /System/Library/Frameworks/Python.framework/Versions/2.7/. This fails, of course, due to permissions (and system integrity protection).
>>
>> You can, in fact, do the upgrade with the "--ignore-installed" flag in pip (although there's still a problem with pyobjc-framework-Message).
>>
>> So: are these errors expected? Is it something in my particular setup? Or the beta program? Is "--ignore-installed" the correct solution?
>>
>> Thanks,
>>
>> Andrew
>>
>>> On 13 Sep 2016, at 16:13, Christopher Barker <pythonchb at gmail.com> wrote:
>>>
>>> If you are dealing with stuff in /System, then you are dealing with the Ape installed Python, not the Python.org build.
>>>
>>> It's easy for "pip" and python to get out of sync.
>>>
>>> Try "which pip" to see which pip you are running.
>>>
>>> This is why I recommend encoding pip via:
>>>
>>> python -m pip [args]
>
> [I tried to comment via the gmane newsgroup version of the lists and my messages never appeared so I hope this works…]
>
> Just to be clear, I am indeed using the framework pip, which is part of why this is so confusing. In the past, as far as I know, it’s never tried to have anything to do with /System. Again, I don’t know if it’s something about macOS 10.12 Sierra, or my particular setup that is the problem. Also, to be clear, there are no PYTHON* or other environment variables that would affect the python path. Here is a failing session…
>
> (Aside: I understand that "pyobjc-framework-Message” is actually a bad example: it is the only package that even —-ignore-installed actually fails on, because it has the "--single-version-externally-managed” problem which is a different kettle of fish. But I think the above error message is the same as the one that I would get for any of the other packages in question. Note that pip2 install works fine for packages other than those in my original list.)
>
> $ command which pip2
> /Library/Frameworks/Python.framework/Versions/2.7/bin/pip2
>
> $ pip2 install --upgrade pyobjc-framework-Message
> Collecting pyobjc-framework-Message
> Using cached pyobjc-framework-Message-3.1.1.tar.gz
> Requirement already up-to-date: pyobjc-core>=3.1.1 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from pyobjc-framework-Message)
> Requirement already up-to-date: pyobjc-framework-Cocoa>=3.1.1 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from pyobjc-framework-Message)
> Installing collected packages: pyobjc-framework-Message
> Found existing installation: pyobjc-framework-Message 2.5.1
> Uninstalling pyobjc-framework-Message-2.5.1:
> Exception:
> Traceback (most recent call last):
> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
> status = self.run(options, args)
> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/commands/install.py", line 317, in run
> prefix=options.prefix_path,
> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_set.py", line 736, in install
> requirement.uninstall(auto_confirm=True)
> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_install.py", line 742, in uninstall
> paths_to_remove.remove(auto_confirm)
> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
> renames(path, new_path)
> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/utils/__init__.py", line 267, in renames
> shutil.move(old, new)
> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in move
> copytree(src, real_dst, symlinks=True)
> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree
> raise Error, errors
> Error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/Message/__init__.py', '/var/folders/bk/zdhpxqj14y5fzcvlpybb4b640000gn/T/pip-Gd3OiE-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/Message/__init__.py', "[Errno 1] Operation not permitted: '/var/folders/bk/zdhpxqj14y5fzcvlpybb4b640000gn/T/pip-Gd3OiE-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/Message/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/Message/__init__.pyc', '/var/folders/bk/zdhpxqj14y5fzcvlpybb4b640000gn/T/pip-Gd3OiE-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/Message/__init__.pyc', "[Errno 1] Operation not permitted: '/var/folders/bk/zdhpxqj14y5fzcvlpybb4b640000gn/T/pip-Gd3OiE-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/Message/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/Message/_metadata.py', '/var/folders/bk/zdhpxqj14y5fzcvlpybb4b640000gn/T/pip-Gd3OiE-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/Message/_metadata.py', "[Errno 1] Operation not permitted: '/var/folders/bk/zdhpxqj14y5fzcvlpybb4b640000gn/T/pip-Gd3OiE-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/Message/_metadata.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/Message/_metadata.pyc', '/var/folders/bk/zdhpxqj14y5fzcvlpybb4b640000gn/T/pip-Gd3OiE-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/Message/_metadata.pyc', "[Errno 1] Operation not permitted: '/var/folders/bk/zdhpxqj14y5fzcvlpybb4b640000gn/T/pip-Gd3OiE-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/Message/_metadata.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/Message', '/var/folders/bk/zdhpxqj14y5fzcvlpybb4b640000gn/T/pip-Gd3OiE-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/Message', "[Errno 1] Operation not permitted: '/var/folders/bk/zdhpxqj14y5fzcvlpybb4b640000gn/T/pip-Gd3OiE-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/Message'”)]
>
>
> _______________________________________________
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
> https://mail.python.org/mailman/listinfo/pythonmac-sig
> unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma Goldman
More information about the Pythonmac-SIG
mailing list