Preface: My OS X Installing Python is a mess . I started using the Python system before learning about Homebrew. And so I used sudo pip install with forever. Now I am trying to clear everything and then install / link package packages with Python Homebrew.
1) In many SO answers, people suggest doing: pip freeze | xargs sudo pip uninstall -y pip freeze | xargs sudo pip uninstall -y This does not work for me. I get a very long trace. These are the most representative fragments:
~ $ pip freeze | xargs sudo pip uninstall -y You are using pip version 7.1.2, however version 8.0.2 is available. You should consider upgrading via the 'pip install --upgrade pip' command. The directory '/Users/smaniato/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo -H flag. Uninstalling altgraph-0.10.2: Exception: Traceback (most recent call last): File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 211, in main [...] Error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/__init__.py', '/tmp/pip-p8yIlU-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/__init__.py', "[Errno 1] Operation not permitted: '/tmp/pip-p8yIlU-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/__init__.pyc', '/tmp/pip-p8yIlU-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/__init__.pyc', [...] "[Errno 1] Operation not permitted: '/tmp/pip-p8yIlU-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph'")]
where altgraph is just the first pip package in the pip list (remember this).
2) Then I tried pip freeze | xargs sudo -H pip uninstall -y pip freeze | xargs sudo -H pip uninstall -y as the warning was suggested, but this will simply remove the warning. Error messages were saved.
3) I also tried using any directories that raised complaints (e.g. ~/Library/Caches/pip and some of his parents and children). For some reason I cannot chown most problematic directory, /tmp :
~ $ sudo chown -R ${USER} /tmp chown: /tmp: Operation not permitted
4) Finally, I tried to manually remove the package from the following list and voila, I could easily do sudo pip uninstall virtualenv , for example. Attempting to manually remove altgraph results in the same error above.
Any ideas on how to proceed? Remember, I do not care about any package; I just want to use nuke pip and start from scratch using Homebrew Python. Thanks!
Update:
- Going down the list manually, the same thing happens with
bdist-mpkg-0.5.0 - A few more:
matplotlib , zope.interface , xattr , six , scipy , pytz .