Thejus Krishna
Thejus Krishna

Reputation: 1899

pynput installation failing in python 2.7

I tried to install pynput by doing pip install pynput. It throws an error in pyobjc-core-2.5.1. It tries to uninstall and install the package but an exception is thrown.

pip install pynput
Collecting pynput
  Using cached pynput-1.3.5-py2.py3-none-any.whl
Requirement already satisfied: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from pynput)
Requirement already satisfied: enum34; python_version == "2.7" in /Library/Python/2.7/site-packages (from pynput)
Collecting pyobjc-framework-Quartz>=3.0; sys_platform == "darwin" (from pynput)
  Using cached pyobjc_framework_Quartz-3.2.1-cp27-cp27m-macosx_10_6_intel.whl
Collecting pyobjc-core>=3.2.1 (from pyobjc-framework-Quartz>=3.0; sys_platform == "darwin"->pynput)
  Using cached pyobjc_core-3.2.1-cp27-cp27m-macosx_10_6_intel.whl
Collecting pyobjc-framework-Cocoa>=3.2.1 (from pyobjc-framework-Quartz>=3.0; sys_platform == "darwin"->pynput)
  Using cached pyobjc_framework_Cocoa-3.2.1-cp27-cp27m-macosx_10_6_intel.whl
Installing collected packages: pyobjc-core, pyobjc-framework-Cocoa, pyobjc-framework-Quartz, pynput
  Found existing installation: pyobjc-core 2.5.1
    Uninstalling pyobjc-core-2.5.1:
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/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  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/PyObjC/PyObjCTools/__init__.py', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/__init__.py', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/__init__.pyc', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/__init__.pyc', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/AppCategories.py', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/AppCategories.py', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/AppCategories.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/AppCategories.pyc', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/AppCategories.pyc', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/AppCategories.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/AppHelper.py', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/AppHelper.py', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/AppHelper.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/AppHelper.pyc', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/AppHelper.pyc', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/AppHelper.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/Conversion.py', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/Conversion.py', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/Conversion.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/Conversion.pyc', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/Conversion.pyc', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/Conversion.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/Debugging.py', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/Debugging.py', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/Debugging.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/Debugging.pyc', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/Debugging.pyc', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/Debugging.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/FndCategories.py', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/FndCategories.py', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/FndCategories.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/FndCategories.pyc', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/FndCategories.pyc', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/FndCategories.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/KeyValueCoding.py', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/KeyValueCoding.py', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/KeyValueCoding.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/KeyValueCoding.pyc', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/KeyValueCoding.pyc', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/KeyValueCoding.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/MachSignals.py', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/MachSignals.py', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/MachSignals.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/MachSignals.pyc', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/MachSignals.pyc', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/MachSignals.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/NibClassBuilder.py', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/NibClassBuilder.py', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/NibClassBuilder.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/NibClassBuilder.pyc', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/NibClassBuilder.pyc', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/NibClassBuilder.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/Signals.py', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/Signals.py', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/Signals.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/Signals.pyc', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/Signals.pyc', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/Signals.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/TestSupport.py', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/TestSupport.py', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/TestSupport.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/TestSupport.pyc', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/TestSupport.pyc', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools/TestSupport.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools', '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools', "[Errno 1] Operation not permitted: '/var/folders/hd/p6kgn6zx2q98dhht353zy1ph0000gn/T/pip-sP_xhJ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/PyObjCTools'")]

Upvotes: 3

Views: 4259

Answers (1)

Emre Akı
Emre Akı

Reputation: 155

I am using macOS Sierra Version 10.12.6, and from what I have heard, this is a common issue following the release of OS X El Capitan, at least on Mac platforms.

What happens is basically you have triggered something called the System Integrity Protection built in the OS itself, which prevents some paths of root filesystems from being modified - even by the root user. So, using sudo would not work either.

Using pip, you may include the flag --user in your command and install files onto your home directory to tackle this issue. So, try executing the command pip install pynput --user.

For further info, consider checking this article.

Upvotes: 6

Related Questions