bret
bret

Reputation: 93

Error upgrading pip on Mac: IOError: [Errno 1] Operation not permitted: '/bin/pip'

I'm on OS X El Capitan 10.11.6 with homebrew installed python 2.7. I've removed and re-installed python via homebrew with no joy. pip can neither install site-packages or update itself.

Trying to upgrade pip and receive the following error:

$ pip install --upgrade pip
Collecting pip
  Using cached pip-9.0.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 8.1.2
    Uninstalling pip-8.1.2:
      Successfully uninstalled pip-8.1.2
  Rolling back uninstall of pip
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/site-packages/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 742, in install
    **kwargs
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 831, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 1032, in move_wheel_files
    isolated=self.isolated,
  File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 463, in move_wheel_files
    generated.extend(maker.make(spec))
  File "/usr/local/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.py", line 372, in make
    self._make_script(entry, filenames, options=options)
  File "/usr/local/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.py", line 276, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "/usr/local/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.py", line 250, in _write_script
    self._fileop.write_binary_file(outname, script_bytes)
  File "/usr/local/lib/python2.7/site-packages/pip/_vendor/distlib/util.py", line 405, in write_binary_file
    with open(path, 'wb') as f:
IOError: [Errno 1] Operation not permitted: '/bin/pip'
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Upvotes: 0

Views: 327

Answers (1)

bret
bret

Reputation: 93

Found the answer here: Python: pip tries to install to /bin directory

I had a .pydistutils.cfg file in my home directory that was a workaround for something else (I forget what) and once removed it solved all my pip problems.

Upvotes: 3

Related Questions