Reputation: 1052
When I run "pip list" on my computer that has MacOS Sierra 10.12.6, some packages are listed on the terminal:
IST01-12345:~ myMac$ sudo pip list
altgraph (0.10.2)
bdist-mpkg (0.5.0)
bonjour-py (0.3)
macholib (1.5.1)
matplotlib (1.3.1)
modulegraph (0.10.4)
numpy (1.8.0rc1)
pip (9.0.1)
py2app (0.7.3)
pyobjc-core (2.5.1)
pyobjc-framework-Accounts (2.5.1)
pyobjc-framework-AddressBook (2.5.1)
pyobjc-framework-AppleScriptKit (2.5.1)
pyobjc-framework-AppleScriptObjC (2.5.1)
pyobjc-framework-Automator (2.5.1)
pyobjc-framework-CFNetwork (2.5.1)
pyobjc-framework-Cocoa (2.5.1)
pyobjc-framework-Collaboration (2.5.1)
pyobjc-framework-CoreData (2.5.1)
pyobjc-framework-CoreLocation (2.5.1)
pyobjc-framework-CoreText (2.5.1)
pyobjc-framework-DictionaryServices (2.5.1)
pyobjc-framework-EventKit (2.5.1)
pyobjc-framework-ExceptionHandling (2.5.1)
pyobjc-framework-FSEvents (2.5.1)
pyobjc-framework-InputMethodKit (2.5.1)
pyobjc-framework-InstallerPlugins (2.5.1)
pyobjc-framework-InstantMessage (2.5.1)
pyobjc-framework-LatentSemanticMapping (2.5.1)
pyobjc-framework-LaunchServices (2.5.1)
pyobjc-framework-Message (2.5.1)
pyobjc-framework-OpenDirectory (2.5.1)
pyobjc-framework-PreferencePanes (2.5.1)
pyobjc-framework-PubSub (2.5.1)
pyobjc-framework-QTKit (2.5.1)
pyobjc-framework-Quartz (2.5.1)
pyobjc-framework-ScreenSaver (2.5.1)
pyobjc-framework-ScriptingBridge (2.5.1)
pyobjc-framework-SearchKit (2.5.1)
pyobjc-framework-ServiceManagement (2.5.1)
pyobjc-framework-Social (2.5.1)
pyobjc-framework-SyncServices (2.5.1)
pyobjc-framework-SystemConfiguration (2.5.1)
pyobjc-framework-WebKit (2.5.1)
pyOpenSSL (0.13.1)
pyparsing (2.0.1)
python-dateutil (1.5)
pytz (2013.7)
scipy (0.13.0b1)
setuptools (18.5)
six (1.4.1)
virtualenv (15.1.0)
xattr (0.6.4)
zope.interface (4.1.1)
However, when I uninstall one (altgraph) of these packages, I get an error such as below:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/uninstall.py", line 76, in run
requirement_set.uninstall(auto_confirm=options.yes)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 346, in uninstall
req.uninstall(auto_confirm=auto_confirm)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in move
copytree(src, real_dst, symlinks=True)
File "/System/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/altgraph/__init__.py', '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/__init__.py', "[Errno 1] Operation not permitted: '/tmp/pip-BQys7K-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-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/__init__.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Dot.py', '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Dot.py', "[Errno 1] Operation not permitted: '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Dot.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Dot.pyc', '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Dot.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Dot.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Graph.py', '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Graph.py', "[Errno 1] Operation not permitted: '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Graph.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Graph.pyc', '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Graph.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Graph.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphAlgo.py', '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphAlgo.py', "[Errno 1] Operation not permitted: '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphAlgo.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphAlgo.pyc', '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphAlgo.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphAlgo.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphStat.py', '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphStat.py', "[Errno 1] Operation not permitted: '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphStat.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphStat.pyc', '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphStat.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphStat.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphUtil.py', '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphUtil.py', "[Errno 1] Operation not permitted: '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphUtil.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphUtil.pyc', '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphUtil.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphUtil.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/ObjectGraph.py', '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/ObjectGraph.py', "[Errno 1] Operation not permitted: '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/ObjectGraph.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/ObjectGraph.pyc', '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/ObjectGraph.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/ObjectGraph.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph', '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph', "[Errno 1] Operation not permitted: '/tmp/pip-BQys7K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph'")]
I also checked some paths and versions:
IST01-12345:~ myMac$ which python && python --version
/usr/bin/python
Python 2.7.10
IST01-12345:~ myMac$ which pip && pip --version
/usr/local/bin/pip
pip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)
IST01-12345:~ myMac$ which easy_install && easy_install --version
/usr/bin/easy_install
setuptools 18.5 from /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (Python 2.7)
IST01-12345:~ myMac$ which pytz && pytz --version
IST01-12345:~ myMac$ which scipy && scipy --version
IST01-12345:~ myMac$ which altgraph && altgraph --version
Although "pytz", "scipy" and "altgraph" are shown in the list, I cannot find their paths and versions. What do you think? How can I uninstall them, or how can I remove these packages from this list? Does using python under /usr/bin instead of python /usr/local/bin occur this problem?
Upvotes: 1
Views: 4331
Reputation: 22483
Security issue? If so, run pip as superuser:
sudo pip uninstall <packagename>
One of the problems with Python installs is that there are often multiple, and they differ quite a bit in where they put their files, esp. across the Python 2 and Python 3 divide, and with several major sources of Python builds (Apple default, Homebrew, Python.org builds, ActiveState, Enthought Canopy, ...). Some of these install using Apple location guidelines, some using Unix conventions, some using other Unix conventions, some in the user space, .... Basically, it's a mess, just knowing where the files live. Just a few of the possible places to look:
/Library/Python/2.7/site-packages
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
/System/Library/Frameworks/Python.framework/Versions/2.7/
I have often found that I have to cd
to these file locations, root around to find the lib
and site-packages
directories, and use rm
(often sudo rm -rf <file-or-directory>
) to truly remove some vestiges of modules, esp. if a mix of easy_install
, pip install
, python setup.py install
install techniques were used.
The /Library
and /System/Library
prefixes suggest you are using / depending on Apple-installed Python, in official locations. So sudo
authorizations a must. The cd
/rm
route possibly required.
Upvotes: 2